如何从 proguard 中排除 .so 文件?

发布于 2024-11-27 13:35:02 字数 1823 浏览 3 评论 0原文

这是我当前的 Android 项目的 proguard 配置文件:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-repackageclasses
-libraryjars "libs/**.so"
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keep public class com.scoreloop.** {*;}
-keep public class com.facebook.** {*;}
-keep public class com.google.ads.** {*;}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-assumenosideeffects class android.util.Log {
    public static *** i(...);
    public static *** v(...);
    public static *** d(...);
}

防止 Proguard 尝试干扰共享对象的正确方法是什么?目前,当我将它们添加到我的项目并尝试导出应用程序时,我会收到错误:You should check if you need to指定其他程序 jars。 在添加 之后-libraryjars 行它给我:java.io.IOException:无法读取[proguard.ClassPathEntry@56f0474c](没有这样的文件或目录)。我该如何修复我的 Proguard 配置文件?

This is my current proguard config file for my Android project:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-repackageclasses
-libraryjars "libs/**.so"
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keep public class com.scoreloop.** {*;}
-keep public class com.facebook.** {*;}
-keep public class com.google.ads.** {*;}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-assumenosideeffects class android.util.Log {
    public static *** i(...);
    public static *** v(...);
    public static *** d(...);
}

What would be the correct way to prevent Proguard from trying to mess with the shared objects? I'm currently getting an error as soon as I add them to my project, and try to export an application: You should check if you need to specify additional program jars. After I add the -libraryjars line it's giving me: java.io.IOException: Can't read [proguard.ClassPathEntry@56f0474c] (No such file or directory). How would I fix my Proguard config file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲凉≈ 2024-12-04 13:35:02

比照。 ProGuard手册> 故障排除

上面的控制台输出“您应该检查是否需要指定其他程序 jar。”实际上告诉了出了什么问题。

Cfr. ProGuard manual > Troubleshooting

The console output above "You should check if you need to specify additional program jars." actually tells what is wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文