[英]Proguard Warning : com.example.android.PaymentGateway: can't find referenced field 'int container_pg' in class com.example.android.R$id
I am using proguard in android app. 我在Android应用程序中使用proguard。 It is required to add this to make code obfuscated and difficult to do reverse engineering. 需要添加此代码以使代码混淆并且难以进行逆向工程。
I am getting this problem while export the apk. 我在导出apk时遇到此问题。 Proguard throws below warning even I use the -dontskipnonpubliclibraryclassmembers
. 即使我使用-dontskipnonpubliclibraryclassmembers
Proguard也会低于警告。 I am not sure what additional things I need to do to resolve this. 我不确定我需要做些什么来解决这个问题。
Please assist and thanks in advance. 请提前协助并表示感谢。
[2014-08-14 15:48:28 - ] Warning: com.example.android.PaymentGateway: can't find referenced field 'int container_pg' in class com.example.android.R$id
[2014-08-14 15:48:28 - ] Warning: com.example.android.PaymentGateway$RetrieveEncKey: can't find referenced field 'int container_pg' in class com.example.android.R$id
[2014-08-14 15:48:28 - ] You should check if you need to specify additional program jars.
[2014-08-14 15:48:28 - ] Warning: there were 2 unresolved references to program class members.
[2014-08-14 15:48:28 - ] Your input classes appear to be inconsistent.
[2014-08-14 15:48:28 - ] You may need to recompile them and try again.
[2014-08-14 15:48:28 - ] Alternatively, you may have to specify the option
[2014-08-14 15:48:28 - ] '-dontskipnonpubliclibraryclassmembers'.
[2014-08-14 15:48:28 - ] java.io.IOException: Please correct the above warnings first.
[2014-08-14 15:48:28 - ] at proguard.Initializer.execute(Initializer.java:321)
[2014-08-14 15:48:28 - ] at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-08-14 15:48:28 - ] at proguard.ProGuard.execute(ProGuard.java:86)
[2014-08-14 15:48:28 - ] at proguard.ProGuard.main(ProGuard.java:492)
From the Proguard troubleshooting guide : 从Proguard故障排除指南 :
Your compiled class files are inconsistent with the libraries. 您编译的类文件与库不一致。 You may need to recompile the class files, or otherwise upgrade the libraries to consistent versions. 您可能需要重新编译类文件,或者将库升级到一致的版本。
[...] [...]
If you're developing for Android and ProGuard complains that it can't find a method that is only available in a recent version of the Android run-time, you should change the build target in your project.properties file or build.gradle file to that recent version. 如果您正在为Android开发并且ProGuard抱怨它无法找到仅在最近版本的Android运行时中可用的方法,则应更改project.properties文件或build.gradle文件中的构建目标到最近的版本。 You can still specify a different minSdkVersion and a different targetSdkVersion in your AndroidManifest.xml file. 您仍然可以在AndroidManifest.xml文件中指定不同的minSdkVersion和不同的targetSdkVersion。
If you can't resolve it that way, you can try -dontwarn com.example.android.R$id
and see if your application runs despite the warnings, which is sometimes the case. 如果您无法以这种方式解决它,您可以尝试-dontwarn com.example.android.R$id
并查看您的应用程序是否运行尽管有警告,有时也是如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.