首页 文章

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

提问于
浏览
-1
## error ##

java.lang.RuntimeException:com.android.build.api.transform.TransformException:生成主dex列表时出错 .
com.android.build.api.transform.TransformException:生成主dex列表时出错 . com.android.builder.multidex.D8MainDexList $ MainDexListException:com.android.tools.r8.errors.CompilationError:程序类型已存在:androidx.versionedparcelable.NonParcelField
com.android.tools.r8.errors.CompilationError:程序类型已存在:androidx.versionedparcelable.NonParcelField

app的buid gradle

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'

project buid gradle

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
}

1 回答

  • 0

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

    Program type already present com.example.MyClass
    

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

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

    检查Official Doc

相关问题