我试图将我的android项目导出到apk,并且在构建时我在控制台上出现此错误,我通过谷歌循环,但我没有发现任何这样的错误:
[2013-09-24 18:09:42 - Google] Proguard returned with error code 1. See console
[2013-09-24 18:09:42 - Google] proguard.ParseException: Expecting jar or directory name before '-include' in argument number 3
[2013-09-24 18:09:42 - Google] at proguard.ConfigurationParser.readNextWord(ConfigurationParser.java:1133)
[2013-09-24 18:09:42 - Google] at proguard.ConfigurationParser.parseClassPathArgument(ConfigurationParser.java:249)
[2013-09-24 18:09:42 - Google] at proguard.ConfigurationParser.parse(ConfigurationParser.java:130)
[2013-09-24 18:09:42 - Google] at proguard.ProGuard.main(ProGuard.java:484)
这是我的proguard.cfg文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-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.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-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);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-dontskipnonpubliclibraryclassmembers
-libraryjars
任何帮助都会受到赞赏!
答案 0 :(得分:0)
配置文件中的最后一行指定了没有预期参数的选项-libraryjars
。在任何情况下,您都应该删除此行,因为Android构建过程会自动为您指定必要的-injars / -outjars / -libraryjars选项。
请注意,Android SDK的最新版本已弃用proguard.cfg
,而支持基本为空的文件proguard-project.txt
,其中大部分配置位于共享内部配置文件中(均在{ {1}})。