com.android.tools.r8.errors.CompilationError:程序类型已存在:android



##错误##

java.lang.RuntimeException:com.android.build.api.transform.TransformException:生成主索引列表时出错。com.android.build.api.transform.TransformException:生成主索引列表时出错。com.android.builder.multidex.D8MainDexList$MainDexListException:com.android.tools.r8.errors.CompilationError:程序类型已经存在当前:androidx.versionedparcelable.NonParcelField
com.android.tools.r8.errors.Compilation错误:程序类型已存在:androidx.versionedpar celable.Non ParcelField

应用程序的内置渐变

apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mikal.meroshop"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
manifestPlaceholders = [onesignal_app_id               : "1:1063090093562:android:450b13f7ba80306d",
onesignal_google_project_number: "REMOTE"]
multiDexEnabled true
}
buildTypes {
/* debug {
minifyEnabled true
useProguard true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}*/
release {
minifyEnabled false
shrinkResources false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.karumi:dexter:5.0.0'
implementation 'com.tomer:fadingtextview:2.5'
implementation 'com.github.Gavras:MultiLineRadioGroup:v1.0.0.6'
implementation 'com.github.florent37:materialtextfield:1.0.7'
implementation 'com.airbnb.android:lottie:2.2.5'
implementation 'com.github.bumptech.glide:glide:3.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.tomer:fadingtextview:2.5'
implementation 'com.github.florent37:materialtextfield:1.0.7'
implementation 'com.airbnb.android:lottie:2.2.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
implementation 'com.kaopiz:kprogresshud:1.1.0'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.mikepenz:aboutlibraries:6.1.1@aar'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.mikepenz:crossfadedrawerlayout:1.1.0'
implementation 'com.mikepenz:materialdrawer:6.1.1'
// implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "com.mikepenz:materialize:1.2.0"
implementation 'com.webianks.library:easy-feedback:1.0.2'
implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.onesignal:OneSignal:3.10.3'
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
// implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.firebaseui:firebase-ui:1.2.0'
// implementation 'com.firebaseui:firebase-ui-database:1.2.0'
//implementation 'com.google.android.gms:play-services:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation ('com.android.support:multidex:1.0.3')
{
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
}
apply plugin: 'com.google.gms.google-services'

项目建筑坡度

buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven{url  "https://dl.bintray.com/android/android-tools" }
}
/*tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}*/
}
task clean(type: Delete) {
delete rootProject.buildDir
}

如果一个类在运行时类路径上出现多次,则会出现类似以下的错误:

Program type already present com.example.MyClass

在您的情况下,它是androidx.versionedparcelable.NonParcelField所以

只需从build.gradle中删除依赖androidx.versionedparcelable 1.1.0-alpha01(您使用的版本(

检查官方文件

最新更新