【问题标题】:Cannot Build APK无法构建 APK
【发布时间】:2016-12-15 02:23:14
【问题描述】:

我正在尝试构建 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.

【问题讨论】:

    标签: android jar proguard android-proguard


    【解决方案1】:

    我认为这个错误是由于不合适的dependencies 而发生的,我的意思是你可能没有正确设置dependencies 或libraries。请检查一次。

    【讨论】:

    • 我正在使用一个库,我认为有一个问题。见行“(com.starmicronics.starioextension.commandbuilder.c)
    • 我不知道这个库,我也没有使用过这个库..对不起。
    【解决方案2】:

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

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

    -dontwarn com.starmicronics.starioextension.**
    

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        【解决方案4】:

        替换这一行

        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'
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-08-13
          • 1970-01-01
          • 2020-01-27
          • 1970-01-01
          • 2018-03-31
          • 2020-05-15
          相关资源
          最近更新 更多