【问题标题】:proguard not working in Eclipse mac: Unable to access jarfile /Volumes/Newproguard 在 Eclipse mac 中不起作用:无法访问 jarfile /Volumes/New
【发布时间】:2013-06-20 02:02:20
【问题描述】:

我在最新的 ADT 和 Eclipse 中的所有更新源中创建了一个新测试项目,并编辑了 project.propertiesproguard-project.text 我在 mac 的控制台中收到以下错误:

Proguard returned with error code 1. See console
Unable to access jarfile /Volumes/New

我已经尝试了所有方法,我该如何解决?但是在mac里还是报错!

proguard-project.text

# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify

# If you want to enable optimization, you should include the
# following:
# -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
# -optimizationpasses 5
# -allowaccessmodification
#
# Note that you cannot just include these flags in your own
# configuration file; if you are including this file, optimization
# will be turned off. You'll need to either edit this file, or
# duplicate the contents of this file and remove the include of this
# file from your project's proguard.config path property.

-keepattributes *Annotation*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgent
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
-keep public class com.android.vending.licensing.ILicensingService

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
    native <methods>;
}

-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
-dontwarn android.support.**  

project.properties

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17

【问题讨论】:

  • 创建了测试项目,更新了 proguard-project.text,project.properties - 对我来说一切正常。所以... 1.请打开控制台,运行 env 命令并为我提供输出。 2. 打开 eclipse settings/Android 并提供你的“SDK location”。
  • SDK 位置是:/Volumes/New Volume E/adt-bundle-mac-x86_64/adt-bundle-mac-x86_64/sdk 其次,我应该在终端或 Eclipse 中的什么地方输入 env? ?再次感谢您的时间和精力
  • 在终端输入 env 后,我得到的是:结果显示在上面。
  • 将位置拖到 proguard android 所在的终端后,会显示: usernames-MacBook-Pro:New Volume D username$ /Volumes/New\ Volume\ E/adt-bundle-mac-x86_64 /adt-bundle-mac-x86_64/sdk/tools/proguard/proguard-android.txt
  • @ra。如果您还需要什么,请告诉我??再次感谢。

标签: android eclipse proguard


【解决方案1】:

我的建议是:

编辑您的 ~/.profile 文件(在文件末尾添加以下行)

export ANDROID_SDK_ROOT=/Volumes/New\ Volume\ E/adt-bundle-mac-x86_64/adt-bundle-mac-x86_64/sdk
export PATH=ANDROID_SDK_ROOT/platform-tools:ANDROID_SDK_ROOT/tools:$PATH

真的不确定您是否需要 ANDROID_SDK_ROOT/tools,但可以肯定...

重新启动 ADT(不确定是否必须注销/登录您的帐户,如有必要,请执行此操作)

希望对你有所帮助

还有一条评论:如果可能,请尝试将 SDK 移动到本机 Mac 卷

编辑:
~/.profile --> ~ 是您的主目录的同义词,例如/Users/&lt;your_user_name&gt; .profile 是隐藏文件

【讨论】:

  • 我没有在 /users/ 中找到 .profile 文件,但它在 etc/profile 中是否正确??
  • 我可以将整个 adt-bundle-mac-x86_64 文件夹复制并粘贴到根目录吗?我会有什么错误吗??
  • 您可以将捆绑包复制到您的主目录
  • 我尝试了你建议的所有方法,但仍然出现同样的错误
  • 我在 main harddisk/users/user/untitled folder/adt-bundle-mac-x86_64 下创建了一个新文件夹(Untitled Folder)。这能工作吗??
猜你喜欢
  • 2012-04-12
  • 1970-01-01
  • 2013-09-27
  • 2018-12-17
  • 2022-12-05
  • 2012-03-18
  • 1970-01-01
  • 1970-01-01
  • 2012-04-04
相关资源
最近更新 更多