onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
476 stars 171 forks source link

NoClassDefFoundError: AmazonAppstoreBillingService in 0.9.8 #400

Closed ataulm closed 10 years ago

ataulm commented 10 years ago

Has the usage of the library changed since the last version? In 0.9.8 (I tried this using the compile 'org.onepf:openiab:0.9.8' and also building the aar from master myself), I get an error:

11-25 13:45:04.350    1503-1503/com.myapp E/dalvikvm﹕ Could not find class 'org.onepf.oms.appstore.AmazonAppstoreBillingService', referenced from method org.onepf.oms.appstore.AmazonAppstore.getInAppBillingService
11-25 13:45:04.406    1503-1503/com.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: org.onepf.oms.appstore.AmazonAppstoreBillingService
            at org.onepf.oms.appstore.AmazonAppstore.getInAppBillingService(AmazonAppstore.java:90)
            at org.onepf.oms.OpenIabHelper.finishSetup(OpenIabHelper.java:908)
            at org.onepf.oms.OpenIabHelper.finishSetup(OpenIabHelper.java:880)
            at org.onepf.oms.OpenIabHelper.access$1700(OpenIabHelper.java:82)
            at org.onepf.oms.OpenIabHelper$12$2.run(OpenIabHelper.java:831)
            at android.os.Handler.handleCallback(Handler.java:725)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)

Looking in master this class is still present, and public. Has the building of the library changed since version at commit c3ff201a585de5b6db3e99727eb523ea75f222ec in such a way as to effect this error?

RomanZhilich commented 10 years ago

Sorry about that. Just updated documentation. To resolve dependencies you have to add our repository to your project. Please add following to your build.gradle:

repositories {
    maven {
        url 'https://raw.githubusercontent.com/onepf/OPF-mvn-repo/master/'
    }
}
ataulm commented 10 years ago

Does this mean that the open-iab aar is being fetched from that repo, or there are dependencies inside open-iab which are found in that repo?

I don't follow how this worked to solve the no class def issue; in any case I would have expected the resources imported via compile 'org.onepf:openiab:0.9.8' to pull in all the dependencies required - it feels obtuse to have another requirement to add a third-party maven repo (unless that's where the openiab library lives).

RomanZhilich commented 10 years ago

or there are dependencies inside open-iab which are found in that repo?

Yes, dependencies are to blame..

I would have expected the resources imported via compile 'org.onepf:openiab:0.9.8' to pull in all the dependencies required.

I get your point. Unfortunately there's not a lot of ways we can go about it:

  1. Compile all dependencies inside OpenIab.jar That's what we used to do. But it feels to hacky and complicates builds.
  2. Upload all dependencies in mavenCental I'm afraid there's legal issues with that option. Some SDKs are proprietary and their distribution is restricted.
  3. Find a way for gradle to automatically resolve transitive dependencies from side repositories. I was hoping for this solution to work, there's even repository tag in pom filled from gradle maven plugin. But it doesn't seem to work. I wasn't even able to find documentation about this feature.

So... yeah. We'll probably stay at current point for a little while and see how it goes. If you have other ideas I'd be grad to here them out.

ataulm commented 10 years ago

na fair enough - we've had similar issues before. Thanks for explaining.

RomanZhilich commented 10 years ago

You're welcome.