如何从 proguard 中排除 .so 文件?
这是我当前的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
比照。 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.