所有人。我使用的是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)'.发布于 2019-11-24 16:03:53
这是a bug in the Android Gradle plugin,现已在Android Studio 3.6中修复。这似乎只是Windows上的一个问题,因为路径格式使用了反斜杠\而不是正斜杠/。我确认我可以在Linux的Android Studio3.5上构建我的应用程序,但不能在Windows上构建。
发布于 2020-11-02 17:12:56
通过将以下内容添加到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
}
}https://stackoverflow.com/questions/58441409
复制相似问题