非法类文件:类模块信息缺少超类型.类文件版本 53 [英] Illegal class file: Class module-info is missing a super type. Class file version 53

查看:24
本文介绍了非法类文件:类模块信息缺少超类型.类文件版本 53的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 firebase perf 依赖项添加到我的项目中时,我收到此错误 Illegal class file: Class module-info is missing a super type.类文件版本 53.我的 Gradle 和 google 服务项目级依赖项是

When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53. My Gradle and google services project-level dependencies are

    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'

我按照他们的文档中提到的确切步骤https://firebase.google.com/docs/perf-mon/get-started-android.

and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.

我尝试过清理和重建以及清除 Android Studio 缓存.

I have tried clean and rebuild and clearing the Android Studio cache.

并且还尝试了来自 StackOverflow 的类似问题解决方案

And also tried similarly issue resolution from StackOverflow

项目级构建gradle

Project level build gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }

    }
    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'  // Performance Monitoring plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

应用级构建gradle

App level build gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
        jcenter()

    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven {
        url 'https://maven.google.com'
    }

}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}

推荐答案

将此添加到您的应用程序级 build.gradle 文件可以暂时解决问题

Adding this to your app-level build.gradle file solves the problem temporarily

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
          }
        }

根据其他答案和评论进行编辑

EDIT as per other answers and comments

将 gradle 插件更改为 3.6.0 以解决它,因为它已在该版本中修复

Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version

这篇关于非法类文件:类模块信息缺少超类型.类文件版本 53的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆