дубликат записи: META-INF/сервисы/javax.аннотация.обработка.Процессор

#java #android #androidx

Вопрос:

Я смог сгенерировать apk непосредственно перед переходом на AndroidX.

я пытаюсь интегрировать push-уведомление onesignal в свое приложение, поэтому я перешел на AndroidX и теперь получаю эту ошибку: duplicate entry: META-INF/services/javax.annotation.processing.Processor

 > Task :app:javaPreCompileRelease FAILED

Execution failed for task ':app:javaPreCompileRelease'.
> Could not resolve all files for configuration ':app:releaseAnnotationProcessorClasspath'.
   > Failed to transform artifact 'compiler.jar (com.github.bumptech.glide:compiler:4.2.0)' to match attributes {artifactType=processed-jar, org.gradle.usage=java-runtime-jars}.
      > Execution failed for JetifyTransform: C:Usersvicky.gradlecachesmodules-2files-2.1com.github.bumptech.glidecompiler4.2.0dda0221515259f0db0f285da492bbebf16996278compiler-4.2.0.jar.
         > Failed to transform 'C:Usersvicky.gradlecachesmodules-2files-2.1com.github.bumptech.glidecompiler4.2.0dda0221515259f0db0f285da492bbebf16996278compiler-4.2.0.jar' using Jetifier. Reason: duplicate entry: META-INF/services/javax.annotation.processing.Processor. (Run with --stacktrace for more details.)
 

сразу после перехода на AndroiX.

Чтобы решить эту проблему, я попробовал это:

 packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    packagingOptions {
        pickFirst  'META-INF/*'
    }
 

я попробовал этот код вместе и один за другим, но я все еще получаю эту ошибку.

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.3'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
 

build.gradle(модуль)

 apply plugin: 'com.android.application'
android {

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    packagingOptions {
        pickFirst  'META-INF/*'
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    compileSdkVersion 29

    defaultConfig {
        applicationId "com.usd.spintoearn"
        minSdkVersion 17
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        buildToolsVersion '28.0.3'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.media:media:1.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.firebase:firebase-database:16.0.5'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'pub.devrel:easypermissions:0.3.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.firebaseui:firebase-ui:3.2.2'
    implementation project(path: ':SmoothCheckBox-master')

    // Add the Facebook SDK


    implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'

    implementation 'gun0912.ted:tedpermission:2.2.2'

    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'org.greenrobot:eventbus:3.1.1'

    implementation 'com.google.android.ads.consent:consent-library:1.0.6'

    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'


    implementation 'com.facebook.android:audience-network-sdk:5.1.1'
    implementation 'com.facebook.android:audience-network-sdk:5. '


}