无法建立APK

时间:2016-08-09 06:50:21

标签: android jar proguard android-proguard

我正在尝试构建APK。但我正面临着这个错误。但是我可以使用USB调试直接运行它。

Error:12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"(com.starmicronics.starioextension.commandbuilder.c) that doesn\u0027t come with an","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"indicate that it is *not* an inner class.","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"(com.starmicronics.starioextension.commandbuilder.d) that doesn\u0027t come with an","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
12:16:10.220 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}

12:16:10.235 [ERROR] [org.gradle.BuildExceptionReporter] 
12:16:10.235 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.

4 个答案:

答案 0 :(得分:1)

您正在使用以错误方式创建的库(看起来像com.starmicronics...)。

如果可用,您可以自己从源代码重新编译库,否则,您应该可以通过将以下内容添加到proguard配置文件来阻止警告:

-dontwarn com.starmicronics.starioextension.**

答案 1 :(得分:0)

我认为此错误是由于不合适dependencies而发生的,我的意思是您可能未正确设置dependencieslibraries。请检查一次。

答案 2 :(得分:0)

我刚刚恢复到较旧的gradle插件(gradle:2.1.3和gradle-experimental:0.7.3),它解决了我的问题。

答案 3 :(得分:0)

替换此行

compile 'com.google.android.gms:play-services:8.3.0'

compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'