我能够在迁移到androidx之前生成apk。
我正在尝试将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:\Users\vicky.gradle\caches\modules-2\files-2.1\com.github.bumptech.glide\compiler\4.2.0\dda0221515259f0db0f285da492bbebf16996278\compiler-4.2.0.jar.
> Failed to transform 'C:\Users\vicky.gradle\caches\modules-2\files-2.1\com.github.bumptech.glide\compiler\4.2.0\dda0221515259f0db0f285da492bbebf16996278\compiler-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.+'
}
暂无答案!
目前还没有任何答案,快来回答吧!