zoukankan      html  css  js  c++  java
  • zxing 扫码第三方SDK版本不兼容问题

    在AndroidStudio环境下,或许会遇到下面的问题:

    Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
    > Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
    
     
    

     

    表示测试版本与测试版本不一致,这种问题网上给出的答案是: Rebuilde Project。

    可是每次创建Activity和打开AndroidStudio都要Rebuilde Project太麻烦了。

    在使用 zxing 扫码插件的时候又遇到了这么个问题 :

     

    Error:Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.github.yuzhiqiang1993:zxing:2.1.8] C:Usersasd25.gradlecaches ransforms-1files-1.1zxing-2.1.8.aara404ff49b2cb172765d68a2248efaa73AndroidManifest.xml as the library might be using APIs not available in 15
    Suggestion: use a compatible library with a minSdk of at most 15,
    or increase this project's minSdk version to at least 16,
    or use tools:overrideLibrary="com.yzq.zxinglibrary" to force usage (may lead to runtime failures)

     

    说是MinSdk版本过低,于是修改了下 :

     

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "he3.sd"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.1'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        compile 'com.github.huangyanbin:SmartTable:2.2.0'
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.android.support:support-vector-drawable:26.1.0'
        /*添加依赖*/
        implementation 'com.github.yuzhiqiang1993:zxing:2.1.8'
    }
    
     

     

     

     

    问题都解决了。

  • 相关阅读:
    nginx结合tomcat一起使用
    Markdown速成班
    git pull VS git fetch&merge
    Spring框架学习
    WMS专业名词解释
    持续集成与灰度发布
    selenium webdriver入门
    理解HTTP session原理及应用
    linux常用命令
    转载:Mongodb start
  • 原文地址:https://www.cnblogs.com/yangchaojie/p/9203714.html
Copyright © 2011-2022 走看看