Duplicated “IInAppBillingService.aidl” File - Library + App

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 08:09:53

To solve this problem, follow these steps:

1- open project mode

  1. Delete the IInAppBillingService.aidl file

duplicate entry: com/android/vending/billing/IInAppBillingService$Stub$Proxy.class

This means, that you have two files IInAppBillingService.aidl in your project. Remove the one, that you have imported manually. You should not keep two similar classes in the project.

AsifBuet047

Search for entire project IInAppBillingService and if you find more than one copy of this class then you have to delete all keeping just one class. Delete all billing library dependency from gradle file and it will be build.

OK, so you have already noticed that you have a duplicate file. What you NEED TO DO, is to include the library ONLY ONCE.

In one place, you need to do:

implementation 'library name here'

In all other places, use:

api 'library name here'

This works if you have a aidl file in a dependency library in a module, and also want to access the aidl file in ANOTHER module. You cannot include it in the 2nd module, because you would get a duplicate file.

Note that for bonus points, and since the library includes the aidl, it will likely include android billing. But you might not want THAT implementation, so you can do:

Module 1:

implementation('library_with_aidl_and_old_version_of_other_libs') {
    ['other_lib1', 'other_lib2'].each { exclude group: it }
    ['com.android.vending.billing.*'].each { exclude module: it }
}

Module 2:

api (library_with_aidl_and_old_version_of_other_libs) {
    ['other_lib1', 'other_lib2'].each { exclude group: it }
    ['com.android.vending.billing.*'].each { exclude module: it }
}
implementation 'other_lib1_later_version'
implementation 'other_lib2_later_version'
implementation 'billing_etc'

Note that often, these libraries with billing in them also include old versions of the support library, so you will also need to include:

configurations.all {
    resolutionStrategy {
        force "com.android.support:support-v4:<some_version_code_here>"
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!