Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:添加QR读卡器模块时,程序类型已存在_Android_Android Gradle Plugin_Build.gradle_Zxing - Fatal编程技术网

Android 错误:添加QR读卡器模块时,程序类型已存在

Android 错误:添加QR读卡器模块时,程序类型已存在,android,android-gradle-plugin,build.gradle,zxing,Android,Android Gradle Plugin,Build.gradle,Zxing,我在build.gradle中添加了以下行: 实现'com.journeyapps:zxing安卓嵌入式:3.5.0' 然后在尝试构建项目时出现以下错误: Error: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver 谁能解释一下那个错误的含义吗 这是我当前的整个构建梯度: apply plugin: 'com.android.application' android {

我在build.gradle中添加了以下行:
实现'com.journeyapps:zxing安卓嵌入式:3.5.0'

然后在尝试构建项目时出现以下错误:

Error: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
谁能解释一下那个错误的含义吗

这是我当前的整个构建梯度:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.chaimovy.myapplication"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

configurations.all {exclude group: 'android.support.v4.app', module: 'INotificationSideChannel'}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'org.web3j:core:3.3.1-android'
    implementation 'com.google.android.material:material:1.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
}

有谁能建议一种方法来解决添加了新依赖项的问题吗?

该库具有可传递依赖项:

com.android.support:support-v4:25.3.1
这与您的一些其他应用程序依赖项在以下方面的可传递依赖项相冲突:

com.android.support:support-v4:25.1.0
如果您不想使用zxing android embedded附带的可传递依赖项,可以将其排除在外:

implementation('com.journeyapps:zxing-android-embedded:3.5.0') {
    exclude group: 'com.android.support', module: 'support-v4'
}
您还可以探索冲突的解决策略:

android {
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-v4:25.1.0'
    }
}
您可以使用以下gradle命令查看所有可传递依赖项:

./gradlew -q dependencies app:dependencies