All com.android.support libraries must use the exact same version specification

前端 未结 30 2083
忘掉有多难
忘掉有多难 2020-11-21 05:10

After updating to android studio 2.3 I got this error message. I know it\'s just a hint as the app run normally but it\'s really strange.

All com.andr

30条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 05:49

    After searching and combining answers, 2018 version of this question and it worked for me:

    1) On navigation tab change it to project view

    2) Navigate to [YourProjectName]/.idea/libraries/

    3) Delete all files starting with Gradle__com_android_support_[libraryName]

    E.g: Gradle__com_android_support_animated_vector_drawable_26_0_0.xml

    4) In your gradle file define a variable and use it to replace version number like ${variableName}

    Def variable:

    ext {
        support_library_version = '28.0.0' //use the version of choice
    }
    

    Use variable:

    implementation "com.android.support:cardview-v7:${support_library_version}"
    

    example gradle:

    dependencies {
        ext {
            support_library_version = '28.0.0' //use the version of choice
        }
    
        implementation fileTree(include: ['*.jar'], dir: 'libs')
    
        implementation "com.android.support:animated-vector-drawable:${support_library_version}"
        implementation "com.android.support:appcompat-v7:${support_library_version}"
        implementation "com.android.support:customtabs:${support_library_version}"
        implementation "com.android.support:cardview-v7:${support_library_version}"
        implementation "com.android.support:support-compat:${support_library_version}"
        implementation "com.android.support:support-v4:${support_library_version}"
        implementation "com.android.support:support-core-utils:${support_library_version}"
        implementation "com.android.support:support-core-ui:${support_library_version}"
        implementation "com.android.support:support-fragment:${support_library_version}"
        implementation "com.android.support:support-media-compat:${support_library_version}"
        implementation "com.android.support:appcompat-v7:${support_library_version}"
        implementation "com.android.support:recyclerview-v7:${support_library_version}"
        implementation "com.android.support:design:${support_library_version}"
    
    }
    

提交回复
热议问题