你好我正在編寫一個應用程序,使用兼容性庫,我在應用程序中使用視圖傳呼機。我也是使用操作欄庫,我從這個鏈接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。**」來接受它。 –