首页  编辑  

Jenkins与Gradle持续集成Android编译问题

Tags: /Android/   Date Created:
Gradle持续集成编译安卓Android项目失败的一个错误的解决方法:
Note: there were 10 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 9 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 5 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Warning: there were 58 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 33 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED

如果你的安卓项目,用Android Studio编译成功,但用Jenkins+Gradle来编译的时候失败,并提示以上信息,请修改proguard-android.txt文件(在SDK所在的目录,你也可以单独给项目目录下配置一个proguard-android.txt文件,然后在问价你得末尾,添加以下内容:
-keep class org.apache.** {*; }
-dontwarn org.apache.**
-dontwarn javax.lang.model.**

即可解决问题。