Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "Program type already present"?

When i try to build my project.i got this error

Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat Message{kind=ERROR, text=Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat, sources=[Unknown source file], tool name=Optional.of(D8)}

i also to find solution in stack overflow but it didn't help.here is my build.gradle file

    apply plugin: 'com.android.application'android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.hassan.qrscan"
    minSdkVersion 18
    targetSdkVersion 28
    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'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'}
like image 317
Hassan Fayyaz Avatar asked Sep 28 '18 19:09

Hassan Fayyaz


3 Answers

The Program Type Already Present error Raised whenever your project has the repeating libraries or same library with a different version. You can Check the Dependancies Graph by running

gradlew -q dependencies

or

gradle -q dependencies

(Required the Gradle in your class path)

Just sort out the repeating libraries, remove repeating one and error will go away.

like image 177
Kiran Maniya Avatar answered Nov 03 '22 21:11

Kiran Maniya


I solve this problem by using same version of appcompact and design

 implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
 implementation 'com.android.support:design:28.0.0-alpha1'

but now i got this error

Program type already present: android.support.v4.app.FragmentTransitionCompat21$1

like image 43
Hassan Fayyaz Avatar answered Nov 03 '22 21:11

Hassan Fayyaz


 implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

downgrade the version of dependency to

 implementation 'com.android.support:appcompat-v7:27.1.0'

and also add the design dependency

 implementation 'com.android.support:design:27.1.0'

check it once this works for me

like image 25
harsh Avatar answered Nov 03 '22 20:11

harsh