程序类型已存在:androidx.core.R

问题描述 投票:0回答:2

尝试生成 apk 但显示程序类型已存在:androidx.core.R。尝试了很多方法但没有任何效果,所以请帮助我。

apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'

    android {
        compileSdkVersion 29
        buildToolsVersion "29.0.1"
        defaultConfig {
            dexOptions {
                javaMaxHeapSize "4g"
            }
            applicationId "com.app.a"
            minSdkVersion 19
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            ndk {
                abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
            }  
        }

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

        }
    }
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
       implementation ('androidx.appcompat:appcompat:1.1.0') {
        exclude group :'androidx.core', module : 'core'
     }
        implementation ('androidx.constraintlayout:constraintlayout:1.1.3'){
               exclude group :'androidx.core', module : 'core'
        }
        implementation ('androidx.legacy:legacy-support-v4:1.0.0'){
            exclude group :'androidx.core', module : 'core'
        }
        implementation ('com.google.firebase:firebase-auth:19.1.0'){
            exclude group :'androidx.core', module : 'core'
        }
       Implementation 'androidx.test.espresso:espresso-core:3.2.0'
        api 'com.google.dagger:dagger-android:2.24'
        annotationProcessor 'com.google.dagger:dagger-android-processor:2.24'
        implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
        implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
        implementation 'com.squareup.sqlbrite:sqlbrite:1.1.2'
        implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
        implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'

        implementation 'com.jakewharton.timber:timber:4.5.1'
        implementation 'com.google.dagger:dagger:2.24'
        annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
        implementation ('com.google.android.material:material:1.1.0-alpha10'){
            exclude group :'androidx.core', module : 'core'
        }
        implementation "androidx.multidex:multidex:2.0.1"

        implementation 'com.synnapps:carouselview:0.1.5'

        implementation 'com.google.code.gson:gson:2.8.0' 
        implementation 'com.squareup.okio:okio:1.9.0' 
        implementation 'androidx.lifecycle:lifecycle-viewmodel:2.1.0'
        implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
        implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
        implementation 'com.llollox:androidtoggleswitch:2.0.1'
        implementation 'com.makeramen:roundedimageview:2.3.0'
        implementation 'me.tankery.lib:circularSeekBar:1.2.0'
        implementation ('com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2'){
            exclude group :'androidx.core', module : 'core'
        }

        implementation 'com.github.bumptech.glide:glide:4.9.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

        implementation 'com.google.android.gms:play-services-auth:17.0.0'

        implementation ('com.facebook.android:facebook-android-sdk:[5,6)'){
            exclude group :'androidx.core', module : 'core'
        }
        implementation 'com.rabbitmq:amqp-client:5.7.3'

       implementation ("androidx.work:work-runtime:2.2.0"){
           exclude group :'androidx.core', module : 'core'
       }

        implementation ('com.google.firebase:firebase-analytics:17.2.0'){
            exclude group :'androidx.core', module : 'core'
        }
        implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
        implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
        implementation 'com.google.android.gms:play-services-fitness:18.0.0'


    }

    apply plugin: 'com.google.gms.google-services'

尝试生成 APK 但显示程序类型已存在:androidx.core.R。请帮忙 我,如何解决这个问题?尝试了很多事情但没有任何效果。 预先感谢。

android android-studio android-gradle-plugin build.gradle apk
2个回答
0
投票

我遇到这个问题是因为一个库与 androidX 不兼容。

首先我使用下面的代码解决了这个问题

android.jetifier.blacklist = "your library name"

  1. 后来我用jetifier转换了兼容AndroidX的库

https://developer.android.com/studio/command-line/jetifier


0
投票

图书馆

  implementation 'me.tankery.lib:circularSeekBar:1.2.0'

现已更新为:

implementation 'me.tankery.lib:circularSeekBar:1.4.2'

请参阅 Circular Seek Bar 库。

© www.soinside.com 2019 - 2024. All rights reserved.