我该如何处理警告?
日志
[proguard] Note: duplicate definition of library class...
...
[proguard] Note: there were 370 duplicate class definitions.
[proguard] Initializing...
[proguard] Warning: abc.cba..: can't find superclass or interface xyz.zyx....
...
[proguard] Note: the configuration refers to the unknown class 'android.app.backup.BackupAgentHelper'...
...
[proguard] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer...
...
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 public class !testAppH23.** { *; }
-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 *;
}
这是 使用Proguard的Android Ant构建启用控制台日志。请参阅链接 ant build console log
这是我的build.xml(基本上是它的android原始ant脚本)。请参阅链接 TestAppH23 Android Ant Build With Proguard Enabled
local.properties
sdk.dir=C:\\androiddev\\android-sdk-windows
build.properties
proguard.config=proguard.cfg
key.store=testapph23-release.keystore
key.alias=alisname
key.store.password=storepassword
key.alias.password=aliaspassword
default.properties
target=android-7
我为长篇大论道歉。任何关于正确方向的指导都表示赞赏。
UPDATES1 的的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="testAppH23.activity"
android:versionCode="1"
android:versionName="1.0">
<application
android:icon="@drawable/home"
android:theme="@android:style/Theme.NoTitleBar"
android:label="@string/app_name"
>
<activity
android:name=".start.StartActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Translucent"
android:screenOrientation="portrait"
android:launchMode="singleTask"
>
<intent-filter>
<action
android:name="android.intent.action.MAIN"
>
</action>
<category
android:name="android.intent.category.LAUNCHER"
>
</category>
</intent-filter>
</activity>
.....
<service android:name="com.abc.myjar.papi.PIntentService"></service>
<service android:name=".service.XyzService"></service>
</application>
<uses-library android:name="org.apache.http.entity"/>
<uses-library android:name="org.apache.http.james.mime4j"/>
<uses-permission android:name="android.permission...."/>
<uses-sdk android:minSdkVersion="7" />
</manifest>
答案 0 :(得分:24)
您必须向ProGuard保证输入罐中的某些可疑构造是可以的。
您的程序代码包含org.xmlpull.v1包中的Android运行时类的副本或更好版本。如果那没关系:
-dontwarn org.xmlpull.v1.**
-dontnote org.xmlpull.v1.**
您的程序代码包含org.apache.http中Android运行时类的副本。如果那没关系:
-dontnote org.apache.http.**
包示例中的程序代码是指AWT,Android中不存在。如果那没关系:
-dontwarn java.awt.**
您的PostgreSQL驱动程序引用了Android中不存在的许多javax类。如果那没关系:
-dontwarn org.postgresql.**
等等......
(CFR)。 ProGuard手册&gt; Troubleshooting
最后,您的配置指定-keep public class !testAppH23.** { *;}
,它使除testAppH23
中的公共类及其公共/受保护/私有类成员之外的所有公共类不会被缩小/优化/混淆。这可能会导致关于描述符类的一些(无害的)注释。为保持一致性,您可能希望删除类的“public”,或为类成员添加“public protected”。
答案 1 :(得分:0)
您可以尝试解决它:
-ignorewarnings
答案 2 :(得分:0)
您应该检查您的 strings.xml 资源并使其相等(如果存在)或添加 translatable="false"
<string name="my_text" translatable="false">Hello World</string>