Program type already present: com.android.vending.billing.IInAppBillingService-ThrowExceptions

Exception or error:

Problem occurs only on release build or on generate signed apk, when I build debug – no such problem.

Problem arrived right after upgrade AS to version 3.1

Program type already present: com.android.vending.billing.IInAppBillingService
Message{kind=ERROR, text=Program type already present: com.android.vending.billing.IInAppBillingService, sources=[Unknown source file], tool name=Optional.of(D8)}

enter image description here
dependencies:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    implementation('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.android.billingclient:billing:1.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.github.eggheadgames:Siren:1.5.0'
    implementation 'me.leolin:ShortcutBadger:1.1.18@aar'
    implementation 'me.everything:overscroll-decor-android:1.0.4'
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    //implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.github.esafirm.android-image-picker:imagepicker:1.8.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.google.android.gms:play-services-places:12.0.0'
    implementation 'com.google.android.gms:play-services-gcm:12.0.0'
    implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
    implementation 'com.github.rey5137:material:1.2.4'
    implementation 'com.mikepenz:iconics-core:2.8.9@aar'
    implementation 'com.mikepenz:fontawesome-typeface:4.7.0.1@aar'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:animated-vector-drawable:27.0.2'
    implementation 'com.android.support:customtabs:27.0.2'
    implementation 'com.android.support:support-annotations:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    implementation 'com.google.firebase:firebase-firestore:12.0.0'
    implementation 'com.google.firebase:firebase-storage:12.0.0'
    implementation 'com.google.firebase:firebase-database:12.0.0'
    implementation 'com.google.firebase:firebase-messaging:12.0.0'
    implementation 'com.google.firebase:firebase-auth:12.0.0'
    implementation 'com.google.firebase:firebase-core:12.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'me.relex:circleindicator:1.1.8@aar'
    implementation 'com.yalantis:ucrop:2.2.0'
    implementation 'com.appsflyer:af-android-sdk:4.8.8@aar'
    implementation 'com.android.installreferrer:installreferrer:1.0'
}

M lost to find solution to fix this, any suggestions – welcome. Thanks!

How to solve:

Solution was close:
Finally was able to resolve problem by simple deleting of aidl import lib, now compilation success on both debug and release, don’t know why like this, Documentation seems outdated for inAppPurchases in google, seems this class is added from somewhere automatically.

###

Delete the IinAppBillingService.aidl file from the android studio and just run the app again. Hope this will help.

###

  • Whenever you trying to adding google play billing library with

implementation ‘com.android.billingclient:billing:version-code’

  • You must remove IInAppBillingService.aidl file from your project.

check this path of IInAppBillingService.aidl in Project level view

  • path :- app > src > main > aidi and so on…

You just delete this aidi folder or delete IInAppBillingService.aidl and rebuild your project. An error will disappear.

###

in my case same file added two time at different location with .aidl when I search, in windows explorer source code of project then I able to find it, then I delete it, After it APK generated successfully!

Leave a Reply

Your email address will not be published. Required fields are marked *