【问题标题】:Android apk Debug mode works fine but release mode gives too many warningsAndroid apk 调试模式工作正常,但发布模式给出太多警告
【发布时间】:2014-08-16 09:54:21
【问题描述】:

我正在尝试从 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 之前没有动过。因此,我为/EcliseProject/libs/ 文件夹中的每个罐子添加了-libraryjars /libs/lib-name。所以我想出了以下内容:

-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 多个警告,其中大多数都没有找到上面提到的超类或接口。所以,我得到了包含这些类的罐子,并将它们也放在 /lib/ 文件夹中,并添加了 -libraryjars 条目,包括 rt.jar 等。然后我收到了更多警告,其中一些人说 library class org.xmlpull.v1.XmlPullParser depends on program class java.lang.String

我尝试添加-dontskipnonpubliclibraryclasses,添加一些-dontwarn,等等。到目前为止没有任何效果。

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

我想我错过了一些非常基本的东西。 这些天来,我一直在使用正常工作的调试模式 apk 进行测试。为什么会出现这个问题?请帮忙!!

【问题讨论】:

    标签: android eclipse adt proguard release-mode


    【解决方案1】:

    好的,在 stackoverflow 内部进行了大量的谷歌搜索和搜索之后,我设法找到了解决方案。以下是我的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
    

    希望对其他人有所帮助,谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-10
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      • 1970-01-01
      相关资源
      最近更新 更多