【问题标题】:Exclude 3rd party libraries, it's class & sub class from ProGuard with Android using Eclipse IDE排除 3rd 方库,它是使用 Eclipse IDE 的 ProGuard 的类和子类
【发布时间】:2016-01-28 19:31:09
【问题描述】:

当我尝试在 ProGuard 中排除第 3 方库时出现以下错误。

它正在编译,如果我在 proguard-project.txt 中添加“-dontwarn com.ak.systemservice.core.security.FuncManager”, 但是尝试运行时会崩溃。

基本上我不想混淆 jar 或整个 jar 中的“com.ak.systemservice.core.security.FuncManager”类,并希望在我的活动中使用“com.ak.systemservice.core.security.FuncManager” .提前致谢。

以下是错误:

[2016-01-26 17:00:27 - MyApp] Proguard 返回错误代码 1。请参阅控制台

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.os.ServiceManager

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.os.ServiceManager

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService$Stub

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService$Stub

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 com.ak.systemservice.core.security.FuncManager$1

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 com.ak.systemservice.core.security.FuncManager$1

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

[2016-01-26 17:00:27 - MyApp] 警告:com.ak.systemservice.core.security.FuncManager:找不到引用的类 android.security.FuncService

【问题讨论】:

    标签: java android eclipse obfuscation android-proguard


    【解决方案1】:

    您可以通过避免此类被缩小来解决此问题。将此添加到您的 proguard 文件中,

    -keep class com.ak.** { *; }
    -keep interface com.ak.** { *; }
    -keep enum com.ak.** { *; }
    

    或者你也可以保留个人课程。像这样,

    -keep class com.ak.systemservice.core.security.FuncManager
    

    【讨论】:

    • 还没有!感谢您的跟进!在进行这一步之前,得到JNI原生回调错误,应用程序崩溃了!不知何故,proguard 正在剥离 JNI 方法名称并导致崩溃。如何确保 ProGuard 没有剥离 JNI?如何让特定的 JNI 回调方法远离 ProGuard?谢谢,
    • 默认情况下,JNI 原生函数不会被混淆。但是,如果你在你的代码中使用它并且你的代码被混淆了,那可能会产生问题。更改上面的代码并在包含您的包名称后将其添加到 pro 保护文件以防止这种情况发生。
    【解决方案2】:

    还没有!感谢您的跟进!在进行这一步之前,得到JNI原生回调错误,应用程序崩溃了!不知何故,proguard 正在剥离 JNI 方法名称并导致崩溃。如何确保 ProGuard 没有剥离 JNI?如何让特定的 JNI 回调方法远离 ProGuard?

    谢谢,

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      • 2016-10-22
      • 2015-02-24
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多