您好我正在编写一个使用兼容性库的应用程序,我在应用程序中使用了一个视图寻呼机。我也使用了一个动作栏库,我从这个链接
https://github.com/johannilsson/android-actionbar
我的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
#keep all classes that might be used in XML layouts
-keep public class * extends android.view.View
-keep public class * extends android.app.Fragment
-keep public class * extends android.support.v4.Fragment
#keep all public and protected methods that could be used by java reflection
-keepclassmembernames class * {
public protected <methods>;
}
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-dontwarn **CompatHoneycomb
-dontwarn org.htmlcleaner.*
然后我的defualt.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 use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-8
android.library.reference.1=../android-actionbar/actionbar
proguard.config=proguard.cfg
然而,当我运行编译并签署我的应用程序时,我得到一个对话框,上面写着“Proguard返回错误代码1.请参阅控制台。”
所以我看看我的控制台,其中包含以下内容
[2011-11-01 01:48:39 - Test App] Proguard returned with error code 1. See console
[2011-11-01 01:48:39 - Test App] proguard.ParseException: Unknown option 'Manager' in argument number 9
[2011-11-01 01:48:39 - Test App] at proguard.ConfigurationParser.parse(ConfigurationParser.java:170)
[2011-11-01 01:48:39 - Test App] at proguard.ProGuard.main(ProGuard.java:491)
但这对我来说并不是很重要,我不知道我应该做些什么来让这个工作?我之前在没有使用兼容性库的应用程序上使用过proguard脚本的任何想法,然而,我从那个脚本获得的地方说它应该与兼容性库一起使用但不是吗?任何人都有任何想法,将不胜感激
=== EDIT ===
从我的构建路径中删除空格后,我能够得到更远但仍然失败并出现错误1控制台现在有一个新的错误列表,现在看起来像这样。
[2011-11-01 14:01:20 - TestApp] Proguard returned with error code 1. See console
[2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find superclass or interface android.os.Parcelable$ClassLoaderCreator
[2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator
[2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator
[2011-11-01 14:01:20 - TestApp] Warning: there were 3 unresolved references to classes or interfaces.
[2011-11-01 14:01:20 - TestApp] You may need to specify additional library jars (using '-libraryjars'),
[2011-11-01 14:01:20 - TestApp] or perhaps the '-dontskipnonpubliclibraryclasses' option.
[2011-11-01 14:01:20 - TestApp] java.io.IOException: Please correct the above warnings first.
[2011-11-01 14:01:20 - TestApp] at proguard.Initializer.execute(Initializer.java:308)
[2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.initialize(ProGuard.java:210)
[2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.execute(ProGuard.java:85)
[2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.main(ProGuard.java:499)
答案 0 :(得分:5)
我猜你的项目路径包含空格(在本例中是单词Manager)。 Eclipse的最新Android插件(ADT R14)在将包含空格的路径传递给ProGuard时仍然存在问题。替代解决方案:
答案 1 :(得分:0)
这可能是一些事情,但我遇到这个问题时所做的是:
我不知道以前的项目没有用,但我知道这个技巧对我有用。我希望它有所帮助