j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

Phonegap dont build #862

Closed aoreinoso closed 4 years ago

aoreinoso commented 4 years ago
Phone Gap 8.0.0
Plugin Version: 8.1.0
<preference name="phonegap-version" value="cli-8.0.0" />
<plugin name="cordova-plugin-purchase" spec="^8.1.0">
    <variable name="BILLING_KEY" value="MIIB.....AB" />
</plugin>

Error: /var/gimlet/tmp/47458146212820/3009243/gradlew: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. /var/gimlet/tmp/47458146212820/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:33: error: package com.android.vending.billing does not exist import com.android.vending.billing.IInAppBillingService; ^ /var/gimlet/tmp/47458146212820/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:102: error: cannot find symbol IInAppBillingService mService; ^ symbol: class IInAppBillingService location: class IabHelper /var/gimlet/tmp/47458146212820/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:234: error: package IInAppBillingService does not exist mService = IInAppBillingService.Stub.asInterface(service); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors

j3k0 commented 4 years ago

PhoneGap CLI 8.0.0 ships with cordova-android@7.0.0 (which is supposed to work ok with this version, as it's part of the test suite). Is this correct?

https://build.phonegap.com/current-support

EDIT: I bugged, no need for ionic info ;-) there should be an equivalent command with phonegap.

aoreinoso commented 4 years ago

What can I do? with other versions of phonegap cli or cordova-plugin-purchase does not work either

j3k0 commented 4 years ago

Can you confirm the version of cordova-android you have installed? Maybe run cordova info in the root directory (or phonegap info?) sorry I do not use phonegap, I don't know the tool so well.

aoreinoso commented 4 years ago

I use https://build.phonegap.com and yes PhoneGap CLI 8.0.0 ships with cordova-android@7.0.0

pd: I dont speak english.. i did not understand "I bugged, no need for ionic info ;-) there should be an equivalent command with phonegap"

j3k0 commented 4 years ago

@aoreinoso I guess it's not the answer you want to hear, but it's supposed to work ;-)

I'll try to install phonegap on my computer and see what's happening.

In the meantime, you could try to use the plugin at version 7.2.5, might work (let me know if it does).

aoreinoso commented 4 years ago

... Fetching plugin "cordova-plugin-purchase@^7.2.5" via npm Installing "cordova-plugin-purchase" at "7.2.8" for android ... because: Failed to fetch plugin cordova-plugin-purchase@7.2.5 via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: version not found: cordova-plugin-purchase@7.2.5 ... and the mistake is the same:

:app:compileDebugJavaWithJavac/var/gimlet/tmp/47458146212300/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:33: error: package com.android.vending.billing does not exist import com.android.vending.billing.IInAppBillingService; ^ /var/gimlet/tmp/47458146212300/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:102: error: cannot find symbol IInAppBillingService mService; ^ symbol: class IInAppBillingService location: class IabHelper /var/gimlet/tmp/47458146212300/3009243/app/src/main/java/com/smartmobilesoftware/util/IabHelper.java:234: error: package IInAppBillingService does not exist mService = IInAppBillingService.Stub.asInterface(service); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors FAILED

j3k0 commented 4 years ago

I didn't own ID cordova-plugin-purchase at version 7.2.5. You need to change to cc.fovea.cordova.purchase.

<plugin name="cc.fovea.cordova.purchase" spec="^7.2.5">
    <variable name="BILLING_KEY" value="MIIB.....AB" />
</plugin>
aoreinoso commented 4 years ago

The same error ... Fetching plugin "cc.fovea.cordova.purchase@^7.2.5" via npm Installing "cc.fovea.cordova.purchase" at "7.4.3" for android ...

j3k0 commented 4 years ago

OK... I'm missing something.

j3k0 commented 4 years ago

See https://www.npmjs.com/package/cc.fovea.cordova.purchase --- version 7.2.5 exists there. Why wouldn't phonegap accept to install it?

j3k0 commented 4 years ago

Can you share your full config.xml?

aoreinoso commented 4 years ago

I have made an app only with cordova-plugin-purchase and the error is the same ...

if you want to try it I have used: config.xml


    <?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" android-versionCode="1" version="0.0.1" id="com.ssss.hhhh"  >
    <name>MMMMMMMMM</name>
    <description>mmm</description>
    <author>vvvv</author>
    <content src="index.html"/>
    <preference name="android-build-tool" value="gradle" />
    <platform name="android" >
        <allow-intent href="http://*/*"/>
        <allow-intent href="https://*/*"/>
        <allow-intent href="tel:*"/>
        <allow-intent href="sms:*"/>
        <allow-intent href="mailto:*"/>
        <allow-intent href="geo:*"/>
        <allow-intent href="market:*"/>
        <access origin="*"/>
    </platform>
    <!-- https://build.phonegap.com/current-support -->
    <preference name="phonegap-version" value="cli-8.0.0" />
    <preference name="xwalkMultipleApk" value="false" />
    <plugin name="cordova-plugin-purchase">
        <variable name="BILLING_KEY" value="MIIBIj......AB" />
    </plugin>

    <platform  name="android">
        <preference name="SplashMaintainAspectRatio" value="true"/>
    </platform>
    <preference  name="xwalkCommandLine" value="--disable-pull-to-refresh-effect --ignore-gpu-blacklist"/>
    <platform name="android" >
        <preference name="android-installLocation" value="auto"/>
        <preference name="Fullscreen" value="false"/>
        <preference name="Orientation" value="portrait"/>
        <preference name="android-signed" value="true"/>
        <preference name="AndroidLaunchMode" value="singleTop"/>
    </platform>
    <config-file platform="android" parent="/manifest" mode="merge">
        <uses-permission android:name="com.android.vending.BILLING" />
    </config-file>
    <config-file platform="android" parent="/manifest/application" mode="merge"> 
        <activity android:launchMode="singleTop" />
    </config-file>
    </widget>

and my file hierarchy is: .

├── config.xml
├── icon.png
├── LICENSE.md
├── package-assets
├── README.md
├── screenshot.png
└── www
    ├── css
    ├── index.html
    ├── js
    └── lib
j3k0 commented 4 years ago

I see some places you have to specify source="npm", does it help? (I don't have phonegap on this computer to test)

<plugin name="cc.fovea.cordova.purchase" spec="^7.2.5" source="npm">
aoreinoso commented 4 years ago

the same result

pd: I do not have it installed either ... you create your zip with the sources, you register in phonegap and upload it... https://build.phonegap.com purchase_prueba.zip

aoreinoso commented 4 years ago

I have tried with the same result (from https://www.npmjs.com/package/cc.fovea.cordova.purchase/v/7.2.5)

<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="6.0.0">
   <param name="BILLING_KEY" value="MIIB...."/>
</gap:plugin>
Dexus commented 4 years ago

Please install the latest version and re-add android and iOS platform if else nothing helps!

Von meinem iPhone gesendet

Am 27.05.2019 um 12:50 schrieb aoreinoso notifications@github.com:

I have tried with the same result (from https://www.npmjs.com/package/cc.fovea.cordova.purchase/v/7.2.5)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
aoreinoso commented 4 years ago

I have found https://github.com/AlexDisler/cordova-plugin-inapppurchase/pull/207 I think I need version 7.1.4 of Android in Cordova.

aoreinoso commented 4 years ago

it works with (for example):

<preference name="phonegap-version" value="cli-7.1.0" />

and

aoreinoso commented 4 years ago

<preference name="phonegap-version" value="cli-7.1.0" />

Fetching plugin "cordova-plugin-purchase" via npm
Installing "cordova-plugin-purchase" at "8.1.0" for android

then error:

at com.smartmobilesoftware.inappbilling.InAppBillingPlugin.getPublicKey(InAppBillingPlugin.java:156)

it works with

<preference name="phonegap-version" value="cli-7.1.0" />

and

<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="6.0.0">
   <param name="BILLING_KEY" value="MIIB..."/>
</gap:plugin>

it's not good but it works

j3k0 commented 4 years ago

Yes, problem is phonegap-cli still ships with a cordova-android that had an issue with installing .aidl files, hopefully you can upgrade all to latest when they upgrade to cordova-android@8

aoreinoso commented 4 years ago

Thank you very very much for your time

j3k0 commented 4 years ago

Welcome.

For phonegap cli-8.0.0, you can now use this:

<plugin spec="https://github.com/j3k0/cordova-plugin-purchase.git#phonegap-cli-8.0.0">
    <param name="BILLING_KEY" value="MIIB..."/>
</plugin>

It corresponds to version 8.1.0 of the plugin, with a fix so it builds with phonegap-cli-8.0.0.

I couldn't make a working version for phonegap-cli-8.1.1 (I tried hard), because it ships with cordova-android@7.1.2 which has a bug with installing .aidl files on Android.