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

ERROR 6777001: Init failed - Setup failed. BILLING_UNAVAILABLE: Google Play In-app Billing API version is less than 3 #1486

Closed felipechiodini closed 6 months ago

felipechiodini commented 6 months ago

Observed behavior

ERROR 6777001: Init failed - Setup failed. BILLING_UNAVAILABLE: Google Play In-app Billing API version is less than 3

Expected behavior

Initialize the plugin

System Info

Output of cordova info.

I'm trying to initialize the plugin bug I got this error, I already changed the billing api version to 5.2.1 on android studio.

j3k0 commented 6 months ago

You don't have to change anything with android studio. Latest version of the plugin uses 5.2.1 and sets it up for you.

Can you provide the output to cordova info? What plugin version are you using? Make sure it's cordova-plugin-purchase@13.x.x

pmosedale commented 6 months ago

Am also getting the error and am on 13

felipechiodini commented 6 months ago

Yes, I am in 13.x too, I will send the informations, now I'm on another issue. About the billing version, I changed on the gradlew, as the image below. I'm using capacitor v3, I don't know if this can be an issue for the upgrade.

image

mifkys commented 6 months ago

same problem on emulator Android 13:

Cordova Packages:

    cli: 12.0.0
        common: 5.0.0
        create: 5.0.0
        lib: 12.0.1
            common: 5.0.0
            fetch: 4.0.0
            serve: 4.0.1

Project Installed Platforms:

    android: 12.0.1

Project Installed Plugins:

    @havesource/cordova-plugin-push: 4.0.0
    branch-cordova-sdk: 4.2.0
    cordova-clipboard: 1.3.0
    cordova-plugin-appodeal: 3.2.0-beta1
    cordova-plugin-badge-fix: 0.8.10
    cordova-plugin-camera: 7.0.0
    cordova-plugin-device: 2.1.0
    cordova-plugin-googleplus: 8.5.2
    cordova-plugin-inappbrowser: 5.0.0
    cordova-plugin-local-notification-12: 0.1.4
    cordova-plugin-network-information: 2.0.2
    cordova-plugin-purchase: 13.8.6
    cordova-plugin-statusbar: 2.4.2
    cordova-plugin-vibration: 3.1.1
    cordova-plugin-x-socialsharing: 6.0.4
    cordova-sqlite-storage: 6.0.0
    es6-promise-plugin: 4.2.2
    phonegap-plugin-multidex: 1.0.0
    yandex-appmetrica-plugin-cordova: 5.0.1

Environment:

    OS: Microsoft Windows 11 Pro 10.0.22621 (22621) (Windows 10.0.22621) x64
    Node: v18.7.0
    npm: 8.15.0

android Environment:

    android:
ERROR: Command failed with exit code 1: avdmanager list target
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
        at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 5 more

Project Setting Files:

    config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="" version="18.0.6" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name></name>
    <description></description>
    <author email=""></author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="android-minSdkVersion" value="24" />
    <preference name="android-compileSdkVersion" value="33" />
    <preference name="android-targetSdkVersion" value="33" />
    <preference name="AndroidXEnabled" value="true" />
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/splash.png" />
    <preference name="AndroidWindowSplashScreenBackground" value="#373e46" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="Fullscreen" value="false" />
    <preference name="GradlePluginGoogleServicesEnabled" value="true" />
    <preference name="GradlePluginKotlinEnabled" value="true" />
    <preference name="GradlePluginKotlinVersion" value="1.7.10" />
    <preference name="loadUrlTimeoutValue" value="700000" />
    <preference name="orientation" value="portrait" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="1000" />
    <preference name="StatusBarBackgroundColor " value="#f9d43e" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="webviewbounce" value="false" />
    <platform name="android">
        <resource-file src="google-services.json" target="app/google-services.json" />
        <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
        <resource-file src="resources/android/xml/colors.xml" target="/app/src/main/res/values/colors.xml" />
        <resource-file src="resources/android/values-az/strings.xml" target="app/src/main/res/values-az/strings.xml" />
        <resource-file src="resources/android/values-be/strings.xml" target="app/src/main/res/values-be/strings.xml" />
        <resource-file src="resources/android/values-kk/strings.xml" target="app/src/main/res/values-kk/strings.xml" />
        <resource-file src="resources/android/values-ky/strings.xml" target="app/src/main/res/values-ky/strings.xml" />
        <resource-file src="resources/android/values-ru/strings.xml" target="app/src/main/res/values-ru/strings.xml" />
        <resource-file src="resources/android/values-uk/strings.xml" target="app/src/main/res/values-uk/strings.xml" />
        <resource-file src="resources/android/values-uz/strings.xml" target="app/src/main/res/values-uz/strings.xml" />
        <allow-intent href="market:*" />
        <icon background="@color/background" density="ldpi" foreground="resources/android/icon/drawable-ldpi-icon.png" />
        <icon background="@color/background" density="mdpi" foreground="resources/android/icon/drawable-mdpi-icon.png" />
        <icon background="@color/background" density="hdpi" foreground="resources/android/icon/drawable-hdpi-icon.png" />
        <icon background="@color/background" density="xhdpi" foreground="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon background="@color/background" density="xxhdpi" foreground="resources/android/icon/drawable-xxhdpi-icon.png" />       
        <icon background="@color/background" density="xxxhdpi" foreground="resources/android/icon/drawable-xxxhdpi-icon.png" />     
    </platform>
    <branch-config>

    </branch-config>
    <plugin name="cordova-plugin-statusbar" spec="~2.4.2" />
    <plugin name="cordova-plugin-vibration" spec="3.1.1" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.2" />
</widget>

    package.json:
--- Start of Cordova JSON Snippet ---
{
  "plugins": {
    "cordova-plugin-statusbar": {},
    "cordova-plugin-vibration": {},
    "cordova-plugin-network-information": {},
    "cordova-clipboard": {},
    "branch-cordova-sdk": {},
    "cordova-sqlite-storage": {},
    "cordova-plugin-googleplus": {
      "WEB_APPLICATION_CLIENT_ID": "",
      "PLAY_SERVICES_VERSION": "16.0.+"
    },
    "cordova-plugin-device": {},
    "cordova-plugin-x-socialsharing": {},
    "cordova-plugin-inappbrowser": {},
    "@havesource/cordova-plugin-push": {
      "ANDROIDX_CORE_VERSION": "1.6.+",
      "FCM_VERSION": "23.+"
    },
    "cordova-plugin-camera": {
      "ANDROIDX_CORE_VERSION": "1.6.+"
    },
    "cordova-plugin-local-notification-12": {
      "ANDROID_SUPPORT_V4_VERSION": "26.+",
      "ANDROIDX_VERSION": "1.2.0",
      "ANDROIDX_APPCOMPAT_VERSION": "1.3.1"
    },
    "cordova-plugin-purchase": {},
    "cordova-plugin-appodeal": {},
    "yandex-appmetrica-plugin-cordova": {}
  },
  "platforms": [
    "ios",
    "android"
  ]
}
--- End of Cordova JSON Snippet ---
YadrovSergey commented 6 months ago

I have the same problem on device with Android 13 and Emulator. Were you able to solve it?

2023-11-07_09-40-14

YadrovSergey commented 6 months ago

When I logged into my account on the Android 13 device, this error disappeared and everything worked.