android - 非法类文件:类模块信息缺少超类型。com.google.code.gson\gson\2.8.6
问题描述
我正在尝试在 android studio 上运行我的应用程序,但出现此错误
非法类文件:类模块信息缺少超类型。
Message{kind=ERROR, text=Illegal class file: Class module-info is missing an super type., sources=[C:\Users\Toshiba.DESKTOP-GDLU8MO.gradle\caches\modules-2\files-2.1\com .google.code.gson\gson\2.8.6\9180733b7df8542621dc12e21e87557e8c99b8cb\gson-2.8.6.jar],工具名=Optional.of(D8)}
android {
compileSdkVersion 28
buildToolsVersion '28.0.0'
defaultConfig {
applicationId "com.example.system2.tranxav"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
}
sourceSets {
main {
res.srcDirs = [
'src/main/res/layouts/drawer',
'src/main/res',
'src/main/res/layouts',
]
}
}
}
dependencies {
implementation 'com.stripe:stripe-android:6.1.1'
implementation 'com.stripe:stripe-java:1.47.0'
implementation 'com.stripe:stripe-android:6.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'co.paystack.android:paystack:3.0.10'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.basgeekball:awesome-validation:1.3'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.parse:parse-android:1.16.5'
implementation 'com.parse.bolts:bolts-tasks:1.4.0'
implementation 'com.parse.bolts:bolts-applinks:1.4.0'
implementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.github.NaikSoftware:StompProtocolAndroid:1.1.5'
implementation 'org.java-websocket:Java-WebSocket:1.3.0'
implementation 'com.github.Flutterwave.rave-android:rave_android:2.1.6'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
我的 gradle 版本是 4.4 我如何摆脱这个错误?
解决方案
1.使用Android Gradle插件v3.6.0+和Gradle v5.6.4+。 更新 firebase-perf 插件后,Android Studio 项目未编译(缺少类模块信息)
2.或者回到gson 2.8.5 https://github.com/google/gson/issues/1625
推荐阅读
- angular - How to simplify NgRx effects? Only difference the service method they call-
- php - 带循环的 PHP 动态数组名称
- javascript - 如何修改我的 js 以使其正常工作?
- javascript - 如何将焦点设置在跨域的 iframe 上
- sql-server - AT (@) 符号开始和结束
- r - 错误:内存耗尽(达到限制?) R 代码 Windows 任务计划程序
- r - 为多种值类型重塑 R 中的数据
- python - 如何在 Python 中修复这个 n-gram 提取器?
- sql - 在 SQL 中分解位掩码
- r - R - 在数据框上使用 purr 添加列