【问题标题】:Android studio project not compiling after updating firebase-perf plugin (Class module-info is missing)更新 firebase-perf 插件后,Android Studio 项目未编译(缺少类模块信息)
【发布时间】:2020-02-14 21:26:34
【问题描述】:

每个人。我正在使用 gradle 版本 5.6.2。我像这样更新了我的 android studio 项目依赖项:

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'
    classpath "com.google.firebase:perf-plugin:1.3.1"
}

我这样应用插件:

apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.gms.google-services'

但是现在当我编译我的项目时,会出现这个错误:

Illegal class file: Class module-info is missing a super type. Class file version 53. (Java 9)

它说问题出在 app\build\intermediates\transforms\FirebasePerformancePlugin\bus\debug\9\module-info.class

里面是这样的:

module com.google.gson {
    requires transitive java.sql;

    exports com.google.gson;
    exports com.google.gson.annotations;
    exports com.google.gson.reflect;
    exports com.google.gson.stream;
}

我的猜测是 firebase 开始使用 Java 9,但我的项目目前正在使用 Java 8。我尝试将版本更改为 9,但出现此错误:

Could not target platform: 'Java SE 9' using tool chain: 'JDK 8 (1.8)'.

【问题讨论】:

    标签: android android-studio gradle gson firebase-performance


    【解决方案1】:

    通过将其添加到 build.gradle 暂时解决了:

    debug {
              FirebasePerformance {
                // Set this flag to 'false' to disable @AddTrace annotation processing and
                // automatic HTTP/S network request monitoring
                // for a specific build variant at compile time.
                instrumentationEnabled false
              }
            }
    

    【讨论】:

      【解决方案2】:

      这是a bug in the Android Gradle plugin,现在在Android Studio 3.6 中修复。它看起来只是 Windows 上的一个问题,因为路径格式使用反斜杠 \ 而不是正斜杠 /。我确认我能够在 Linux 上的 Android Studio 3.5 上构建我的应用,但不能在 Windows 上构建。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-04-03
        • 2014-09-07
        • 2017-07-27
        • 2014-10-05
        • 1970-01-01
        • 1970-01-01
        • 2013-06-15
        • 2018-11-05
        相关资源
        最近更新 更多