gpt4 book ai didi

java - 为具有多个 jar 的 android-eclipse 项目配置 ProGuard

转载 作者:行者123 更新时间:2023-12-02 06:20:44 24 4
gpt4 key购买 nike

我想在我的 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 私有(private)库”中) )。另外,我在 libs/armeabi 中放置了一个so库...

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 可以删除/更改一些重要的内容(例如类文件,..)。那么,在启动我的应用程序时,我是否会立即注意到此类异常“错误”,还是必须在运行时检查每个细节并导航到应用程序的任何部分,以确保它按预期运行?

编辑:我正在使用以下 jar :

alljoyn.jar(alljoyn-sdk 的链接资源中还有一个路径变量)

peergroupmanager.jar

android-support-v4.jar

MMSDK.jar

GoogleAdMobAdsSdk-6.4.1.jar

最佳答案

来自http://docs.millennialmedia.com/android-SDK/AndroidFAQ.html

我在 Android 应用程序中使用 ProGuard,我应该怎样做才能确保我的千禧一代广告仍然有效?

为确保您在使用 ProGuard 时仍然收到广告,请将以下代码段添加到您的 proguard.cfg 文件中。

-keepclassmembers class com.millennialmedia.android.* { 
public *;
}
-keep class com.millennialmedia.android.**

当使用 ProGuard 而不是 SpeechKit 时,将以下行添加到其 proguard-project.txt 中:

-dontwarn com.millennialmedia.android.NVASpeechKit*

关于java - 为具有多个 jar 的 android-eclipse 项目配置 ProGuard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21055185/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com