Error: Program type already present, when adding QR reader module [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Error: Program type already present, when adding QR reader module [duplicate]



This question already has an answer here:



I've added the following line to my build.gradle:
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'


implementation 'com.journeyapps:zxing-android-embedded:3.5.0'



and then got this Error when trying to build the project:


Error: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver



Can anyone explain the meaning of that error



This is my entire current build gradle:


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'



And can anyone suggest a way of solving it with the new dependency added?



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




1 Answer
1



That library has a transitive dependency on:


com.android.support:support-v4:25.3.1



Which is conflicting with the transitive dependency some of your other app dependencies have on:


com.android.support:support-v4:25.1.0



If you don't want to to use the transitive dependency that comes with zxing-android-embedded you can exclude it:


implementation('com.journeyapps:zxing-android-embedded:3.5.0')
exclude group: 'com.android.support', module: 'support-v4'



You could also explore a resolution strategy for the conflict:


android
configurations.all
resolutionStrategy.force 'com.android.support:support-v4:25.1.0'




You can see all your transitive dependencies with the following gradle command:


./gradlew -q dependencies app:dependencies

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard