Android-inapp-billing-v3: library with aviary ( in app purchase )

Created on 25 Aug 2015  Â·  25Comments  Â·  Source: anjlab/android-inapp-billing-v3

When I build library with aviary:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/android/vending/billing/IInAppBillingService;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

question

Most helpful comment

Temporary workaround is to remove such classes from library:

  1. Download https://github.com/anjlab/android-inapp-billing-v3/blob/master/sample/libs/anjlab-iabv3-current.jar
  2. Rename it to anjlab-iabv3-current.zip
  3. Delete android/vending/billing/IInAppBillingService*.class (3 files) from anjlab-iabv3-current.zip
  4. Rename it back to .jar
  5. Add anjlab-iabv3-current.jar to your project app/libs folder
  6. In build.gradle of your project comment out: compile ('com.anjlab.android.iab.v3:library:1.0.+')
  7. In build.gradle of your project make sure you have: compile fileTree(dir: 'libs', include: ['*.jar'])
  8. Invalidate caches, clean and rebuild

All 25 comments

Had the same problem in one of my projects. I had to repackage aar file to exclude aidl file. Not the best solution ever. Im glad if someone knows how to fix it...

Yes, I fix it with same solution!

Does any one had the same issue, but ended up with a different solution?

Ideal solution would be to do something like:

    compile ('com.anjlab.android.iab.v3:library:1.0.+') {
        exclude module: 'IInAppBillingService'
    }

Hi,

Did anyone manage to get it fixed?

compile ('com.anjlab.android.iab.v3:library:1.0.+') {
exclude module: 'IInAppBillingService'
}

suggestion does not work.

Temporary workaround is to remove such classes from library:

  1. Download https://github.com/anjlab/android-inapp-billing-v3/blob/master/sample/libs/anjlab-iabv3-current.jar
  2. Rename it to anjlab-iabv3-current.zip
  3. Delete android/vending/billing/IInAppBillingService*.class (3 files) from anjlab-iabv3-current.zip
  4. Rename it back to .jar
  5. Add anjlab-iabv3-current.jar to your project app/libs folder
  6. In build.gradle of your project comment out: compile ('com.anjlab.android.iab.v3:library:1.0.+')
  7. In build.gradle of your project make sure you have: compile fileTree(dir: 'libs', include: ['*.jar'])
  8. Invalidate caches, clean and rebuild

Has anyone got this to work with the Adobe Creative SDK / Aviary?

Getting:

Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/vending/billing/IInAppBillingService$Stub$Proxy.class

Sure Andrew, please read my instructions in previous message:
https://github.com/anjlab/android-inapp-billing-v3/issues/111#issuecomment-226981589

I'm actually using this: https://github.com/idehub/react-native-billing which uses anjlabs package.

I tried using you workaround but couldn't get it to work. It can't find com.anjlab.android.iab.v3.

@finalhit I removed that other package and am try to use android-inapp-billing-v3 directly. I followed your instructions again. Now I am getting this:

Dex: Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.RuntimeException: Exception parsing classes
        at com.android.dx.command.dexer.Main.processClass(Main.java:761)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:727)
        at com.android.dx.command.dexer.Main.access$1200(Main.java:87)
        at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1655)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:681)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:573)
        at com.android.dx.command.dexer.Main.runMultiDex(Main.java:370)
        at com.android.dx.command.dexer.Main.run(Main.java:284)
        at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:52)
        at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1511)
        at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1507)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.android.dx.cf.iface.ParseException: class name (com/anjlab/android/iab/v3/BillingBase) does not match path (anjlab-iabv3-1.0.32/com/anjlab/android/iab/v3/BillingBase.class)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.parseClass(Main.java:773)
        at com.android.dx.command.dexer.Main.access$1600(Main.java:87)
        at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1694)
        at com.android.dx.command.dexer.Main.processClass(Main.java:758)
        ... 17 more

1 error; aborting

Not sure why it is saying this:

Caused by: com.android.dx.cf.iface.ParseException: class name (com/anjlab/android/iab/v3/BillingBase) does not match path (anjlab-iabv3-1.0.32/com/anjlab/android/iab/v3/BillingBase.class)

where the build.gradle in eclipse

Temporary workaround is to remove such classes from library => suggestion does not work.

Error:Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> java.io.IOException: Can't read [/Users/nus/Downloads/VSB/SVB/SubliminalVisionBoard/SubliminalVisionBoard/app/build/intermediates/transforms/jarMerging/release/jars/1/1f/combined.jar] (Can't process class [__MACOSX/anjlab-iabv3-current-2/com/anjlab/android/iab/v3/._BillingBase.class] (Invalid magic number [51607] in class))

same problem
`Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex`

i am facing problem and getting this error :

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/android/vending/billing/IInAppBillingService$Stub$Proxy;

clean + rebuild

same error.

invalidate caches, clean and rebuild.

If that doesn't work -- do you have multiple versions of that AIDL file in your project?

i have only 1 aidl file in project.

And what is that file.

that is the file that i copied from trivial drive example given by google.

Remove it. This library provides that exact file. You can also can't have
duplicates.

On Fri, Apr 27, 2018, 2:45 AM rajan-d notifications@github.com wrote:

that is the file that i copied from trivial drive example given by google.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/anjlab/android-inapp-billing-v3/issues/111#issuecomment-384921642,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFJuveSOVCFf9h2TK9Waf_lY3IzHFVlnks5tsuiigaJpZM4FxcrL
.

Thanks for support.

@finalhit I added the .jar file but now when adding the BillingProcessor its not importing correctly.

@rlee1990 Have you followed all steps: https://github.com/anjlab/android-inapp-billing-v3/issues/111#issuecomment-226981589

@finalhit yes I resolved that issue. Now nothing from the library is importing. I'm using Kotlin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

najam-amfnrh9 picture najam-amfnrh9  Â·  6Comments

joaoarmando picture joaoarmando  Â·  5Comments

RishabhTayal picture RishabhTayal  Â·  3Comments

pro-guitar picture pro-guitar  Â·  6Comments

beshoo picture beshoo  Â·  3Comments