Duplicated “IInAppBillingService.aidl” File - Library + App

你。 提交于 2019-12-22 15:01:24

问题


since almost 2 months I'm searching for a solution for the following Problem. I implemented a library in my app which also includes the IInAppBillingService.aidl file and the other parts of the In App Billing Library from Google. When I'm trying to compile a release version of my app it just throws the following error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/vending/billing/IInAppBillingService$Stub$Proxy.class

For the time being I was just using this Library for in app purchases instead of putting it directly in my. This worked fine for the most part, but what really get on my nerves is that I can't change anything inside the IabHelper.class for example. Since we all no that Google In App Billing solution is sometimes buggy I wanted to edit the IabHelper.class. So now the Problem with 2 "IInAppBillingService.aidl" files is obviously back. I already tried to exclude this part of the Library with the fowlling code:

compile ('com.adobe.creativesdk:image:4.4.8') {
    exclude module: 'com.android.vending.billing'
}

It is NOT working..... :( What can I do? Do you have any other solution for this? I hate it how much time is going to waste on all those Library problems.....

Thanks a lot!!


回答1:


To solve this problem, follow these steps:

1- open project mode

  1. Delete the IInAppBillingService.aidl file




回答2:


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.




回答3:


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.




回答4:


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>"
    }
}


来源:https://stackoverflow.com/questions/38401578/duplicated-iinappbillingservice-aidl-file-library-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!