Android apk调试模式工作正常,但发布模式提供了太多警告

时间:2014-06-25 17:53:10

标签: android eclipse adt proguard release-mode

我正试图从eclipse获得签名的APK。我有一个可调试的apk版本,工作正常。现在,当我尝试使用Eclipse ADT进行编译和签名时,我会收到许多警告,其中大多数是can't find superclass or interface some.package.Class。所以,我提到了thisthis和许多其他人,遗憾的是我无法到达任何地方!

我也会收到Note: there were 314 duplicate class definitions.警告

我的progaurd-project.txt早先没有动过。因此,我为-libraryjars /libs/lib-name文件夹中的每个广告添加了/EcliseProject/libs/。所以我想出了以下内容:

-libraryjars /libs/android-support-v4.jar -libraryjars /libs/apache-mime4j-core-0.7.2.jar -libraryjars /libs/gcm.jar -libraryjars /libs/httpclient-4.3.3.jar -libraryjars /libs/httpcore-4.3.2.jar -libraryjars /libs/httpmime-4.3.3.jar -libraryjars /libs/library.jar -libraryjars /libs/nineoldandroids-2.4.0.jar

到此结束时,我收到了1800多条警告,其中大多数都没有找到上面提到的超类或接口。所以,我得到了那些包含这些类的jar并将它们放在/ lib /文件夹中并添加了-libraryjars条目,包括rt.jar等等。然后我得到了更多警告,其中一些人说{{1} }。

我尝试添加library class org.xmlpull.v1.XmlPullParser depends on program class java.lang.String,添加了一些-dontskipnonpubliclibraryclasses等等。到目前为止,没有任何工作。

在某些时候,我保持足够的-dontwarn以便制作apk,但它只是启动了登录屏幕(第一个活动),一旦点击按钮就卡在那里。

我猜错了一些非常基本的东西。 这些天我一直在测试调试模式apk正常工作。为什么这个麻烦?请帮忙!!

1 个答案:

答案 0 :(得分:1)

stackoverflow 本身进行了大量的Google搜索和搜索之后,我已经设法获得了解决方案。以下是我的proguard-project.txt文件:

-libraryjars /libs/android-support-v4.jar
-libraryjars /libs/apache-mime4j-core-0.7.2.jar
-libraryjars /libs/gcm.jar
-libraryjars /libs/httpclient-4.3.3.jar
-libraryjars /libs/httpcore-4.3.2.jar
-libraryjars /libs/httpmime-4.3.3.jar
-libraryjars /libs/library.jar
-libraryjars /libs/nineoldandroids-2.4.0.jar

-keepnames class org.apache.** {*;}
-keep public class org.apache.** {*;}
-dontwarn org.apache.commons.**
-dontwarn org.apache.http.annotation.ThreadSafe
-dontwarn org.apache.http.annotation.Immutable
-dontwarn org.apache.http.annotation.NotThreadSafe
-dontwarn org.apache.http.impl.auth.GGSSchemeBase
-dontwarn org.apache.http.impl.auth.KerberosScheme
-dontwarn org.apache.http.impl.auth.NegotiateScheme
-dontwarn org.apache.http.impl.auth.KerberosScheme
-dontwarn org.apache.http.impl.auth.SPNegoScheme
-dontwarn se.emilsjolander.stickylistheaders.StickyListHeadersListView
-dontwarn android.net.http.AndroidHttpClient

希望它有所帮助,谢谢!