PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
82 stars 28 forks source link

[Android] Build failed due to dex #11

Closed roblav96 closed 7 years ago

roblav96 commented 7 years ago

Absolutely loving this plugin so far. I got it up and running on iOS in literally seconds =]

I'm having a problem building for android though.

I know it has to do with my gradle dependencies cause when I comment them all out it builds no problem.

Maybe you might be able to see something in these logs I'm not?

tns run android --log trace

14:59:29.554 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: SUCCEEDED
14:59:29.554 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command '/Users/roblav96/Library/Android/build-tools/25.0.2/aapt'' finished with exit value 0 (state: SUCCEEDED)
14:59:29.562 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':buildMetadata'
14:59:29.562 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :buildMetadata (Thread[main,5,main]) completed. Took 5.503 secs.
14:59:29.563 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 30.53 secs, idle: 0.022 secs
14:59:29.571 [ERROR] [org.gradle.BuildExceptionReporter] 
14:59:29.572 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:59:29.573 [ERROR] [org.gradle.BuildExceptionReporter] 
14:59:29.573 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:59:29.573 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':transformClassesWithDexForF0F1F2F3Debug'.
14:59:29.573 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.574 [ERROR] [org.gradle.BuildExceptionReporter] 
14:59:29.574 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
14:59:29.574 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':transformClassesWithDexForF0F1F2F3Debug'.
14:59:29.574 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
14:59:29.575 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
14:59:29.576 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.Factories$1.create(Factories.java:22)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
14:59:29.577 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
14:59:29.578 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.Main.doAction(Main.java:33)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
14:59:29.579 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
14:59:29.580 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    ... 60 more
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:423)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
14:59:29.581 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    ... 69 more
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:119)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:364)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    ... 72 more
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder.dexInProcess(AndroidBuilder.java:1518)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1493)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder.preDexLibraryNoCache(AndroidBuilder.java:1766)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:119)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1721)
14:59:29.582 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:473)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:427)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder.dexInProcess(AndroidBuilder.java:1507)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    ... 6 more
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.ide.common.process.ProcessException: Return code 1 for dex process
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.internal.compiler.DexWrapper$DexProcessResult.assertNormalExitValue(DexWrapper.java:105)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1512)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1507)
14:59:29.583 [ERROR] [org.gradle.BuildExceptionReporter] 
14:59:29.583 [LIFECYCLE] [org.gradle.BuildResultLogger] 
14:59:29.584 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
14:59:29.584 [LIFECYCLE] [org.gradle.BuildResultLogger] 
14:59:29.584 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 38.436 secs

app.gradle dependencies

dependencies {
    compile 'com.google.guava:guava:+'
    compile 'com.google.android.gms:play-services-gcm:+'
    compile 'com.squareup.okhttp3:okhttp:+'
    compile 'com.stripe:stripe-android:+'
    compile 'com.github.sharish:CreditCardView:+'
    compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.amplitude:android-sdk:+'
    compile 'com.getsentry.raven:raven-android:+'
    compile 'com.github.florent37:viewanimator:+'
    compile('com.mikepenz:materialdrawer:+@aar') {
        transitive = true
    }

    compile 'com.github.arimorty:floatingsearchview:+'
    compile 'com.getkeepsafe.taptargetview:taptargetview:+'
    compile 'com.android.support:customtabs:+'

    debugCompile 'com.facebook.stetho:stetho:+'
    debugCompile 'com.facebook.stetho:stetho-okhttp3:+'
    debugCompile 'com.facebook.stetho:stetho-js-rhino:+'

}

I hate asking for another set of eyes for this kind of stuff, but maybe it's something obvious to you?

Let me know what you think. Thanks mate!

PeterStaev commented 7 years ago

Hey @roblav96 , nice to hear that you setup iOS that fast! Sadly I'm not much of a build expert... The only thing that pops up in my mind is may be a problem that the helper AAR for android that the plugin uses is built with older SDK and built tools version: https://github.com/PeterStaev/nativescript-purchase/blob/master/android/inappbilling/inappbillinghelper/build.gradle#L4. Can you try to pull the repo, npm install the deps and then adjust the values to what you are using in your project - I guess buildToolsVersion should be 25.0.2 and not sure what SDK version are you using. Then simply run grunt build which should build a new AAR in the bin/dist folder and try to use that one, instead of the one coming from the NPM package of the plugin.

roblav96 commented 7 years ago

@PeterStaev Thanks for getting back to me.

I just figured out this dep debugCompile 'com.facebook.stetho:stetho-js-rhino:+' was causing the problem. I have no idea why, but I got it to build.

I'm now having trouble getting purchase.getProducts to return anything. I pulled this repo master and built fresh using gulp build then ran the demo.

Here's the example:

console.log('purchase.getProducts', purchase.getProducts) // gets logged
purchase.getProducts().then(function(products) {
    console.log('products', products) // never gets logged
    viewModel.set("items", products)
}).catch(function(error) {
    console.error('Iap.init > error', error) // never gets logged
})

I'm gonna fork this repo and rewrite the android implementation using this library: https://github.com/serso/android-checkout if that's ok with you. Do you have any thoughts?

erjdriver commented 7 years ago

I was able to get the purchase to work.

You know you've got to initialize it in the app.ts/.js file right? And of course it has to be set up properly on the play store developer site.

Also it does take a while for the callback to come back the first time - about 10-15 seconds.

`
purchase.getProducts().then( (products: Array) => {

            this._buyProducts( products );

        } ).catch ( (e) =>
        {
            alert({title: "ERROR1", message: e.message, okButtonText: "Close"});
        })

`

Though I'm waiting for subscriptions to work :(

PeterStaev commented 7 years ago

@roblav96 , I think you had to deploy the version to Google Play in order to get the list. I still have to write the android part of my guide, so I'm not 100% sure, as I forgot what was the case when i created the demo :) Also you need to deploy either to a device or to an emulator with installed Google Apps, as the whole billing on Android is dependent on the Google Play Store app.

As for using a 3rd party lib - i prefer not to use anything external as it makes support a lot harder - for example if anything needs to be fixed in the lib, or to be added

roblav96 commented 7 years ago

@PeterStaev You're totally right about the real device and gapps. I was knocking my head for so long trying to figure out why this wasnt working. lol Good point about the 3rd party libs.

PeterStaev commented 7 years ago

@roblav96 , yes I know... Many small things that most users do not know out of the box. That's why I'm writing those tutorials, as you are not the only that came with the same problem ;)