你好我正在编写一个应用程序,使用兼容性库,我在应用程序中使用视图传呼机。我也是使用操作栏库,我从这个链接Android Proguard Compatiblity Library
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脚本的任何想法,然而,我从那个脚本中得到的地方说它应该与兼容性库一起工作,但它不是?任何人有这将是极大的赞赏
===编辑===
从我的构建路径删除空格我能得到一个有点远,但还是失败,错误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)
请参阅我的编辑我删除了空间形式我的项目路径为您建议,并能够得到更远一点,但仍然失败,错误代码1打印了一些新消息,我的控制台,我有上面编辑我的问题。感谢您向我们提供的帮助 – user577732
我也按照您的建议安装了4.7 beta2,并得到相同的错误并在控制台中打印出来,因为我的编辑 – user577732
第二个错误是由Android兼容性库引用类引起的存在于最近版本的Android API中。在这种情况下,没关系,你可以让ProGuard通过添加“-dontwarn android.support。**”来接受它。 –