【发布时间】:2014-01-10 21:58:17
【问题描述】:
我想在我的 android 应用程序中使用 ProGuard,但我遇到了一些问题。当我通过 android 工具(在 eclipse 中)构建未签名的 apk 时,出现以下错误:
Warning: com.millennialmedia.android.NVASpeechKit$7: can't find referenced class com.nuance.nmdp.speechkit.Recognizer
[...] //more warnings of the same type as above
You should check if you need to specify additional program jars.
Warning: there were 170 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
我在我的应用程序中使用了 5 个 jar 文件,它们都位于 libs 文件夹中并被添加到构建路径中(因此它们可能再次出现在“引用库”和“Android 私有库”中)。另外,我在 libs/armeabi 中放了一个 so-library...
My proguard - file look pretty normal, yet:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontpreverify
-dontskipnonpubliclibraryclasses
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** e(...);
}
我应该怎么做才能修复这个错误?
问候
PS:我知道 proguard 可以删除/更改一些重要的东西(比如类文件,..)。那么,我会在启动我的应用程序时立即通过异常注意到此类“错误”,还是我必须检查每个细节并在运行时导航到我的应用程序的任何部分以确保它按应有的方式运行?
编辑: 我正在使用以下罐子:
alljoyn.jar(在链接到 alljoyn-sdk 的资源中还有一个路径变量)
peergroupmanager.jar
android-support-v4.jar
MMSDK.jar
GoogleAdMobAdsSdk-6.4.1.jar
【问题讨论】:
-
您能否确认您正在使用 Android SDK proguard 配置?如 project.properties 文件中所述> proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt: proguard-project.txt。根据过去的经验,您可能必须为某些 3rd 方库添加一些自定义排除项,您能列出它们吗?
-
那在我的 project.properties proguard.config=C:/Android SDK/tools/proguard/proguard-android.txt:proguard-project.txt 因为库我编辑了问题