All the libraries must use the same versions

后端 未结 2 805
天命终不由人
天命终不由人 2020-12-20 06:57

My depencies

dependencies {
compile \'me.dm7.barcodescanner:zxing:1.9\'
implementation fileTree(dir: \'libs\', include: [\'*.jar\'])
implementation \'com.and         


        
相关标签:
2条回答
  • 2020-12-20 07:28

    There are conflicted dependencies in your project. You need to check up the dependencies tree of your project by running the following command in your Linux terminal:

    ./gradlew app:dependencies
    

    or if you're using Windows:

     gradlew app:dependencies
    

    in your root project. Where app is your module name.

    Quick checking your dependencies block, you will find the following library:

    compile 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
    

    is using support library version 27.1.1 for its dependencies (You can check its build.gradle).

    You can exclude the library from image cropper with:

    implementation ('com.theartofdev.edmodo:android-image-cropper:2.7.0') {    
        exclude group: 'com.android.support'
        exclude module: 'appcompat-v7'
    }
    

    The side effect of using the old version of support library is you can't be so sure that your program will work correctly. It's because the owner of library probably didn't test the library with older version of support library.

    The better way is by changing your BuildToolsVersion, compileSdkVersion, targetSdkVersion, and support libraries to version 27. Something like the following:

    android {
      compileSdkVersion 27
      buildToolsVersion '27.0.3'
    
      defaultConfig {
        applicationId "com.package.name"
        minSdkVersion 15
        targetSdkVersion 27
    
        ...
      }
    
      ...
    }
    
    dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
    
      implementation 'com.android.support:appcompat-v7:27.1.1'
      implementation 'com.android.support:design:27.1.1'
    
      // your other dependencies
      ...
    }
    
    0 讨论(0)
  • 2020-12-20 07:50

    Whenever you see this type of problem, explicitly declare the probelmatic libraries in your gradle file with the same version of your other support libs:

    implementation "com.android.support:animated-vector-drawable:26.1.0"
    implementation "com.android.support:design:26.1.0"
    implementation 'com.android.support:support-vector-drawable:26.1.0'
    

    This happens because some of your dependencies use a different version of it.

    Also, use implementation not compile. Compile has been deprecated:

    implementation 'me.dm7.barcodescanner:zxing:1.9'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    
    0 讨论(0)
提交回复
热议问题