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 initializing plugin on some Android devices (white/blank screen) #1483

Closed fellipefonseca closed 7 months ago

fellipefonseca commented 7 months ago

Observed behavior

Some users are reporting white screen when launching our app. We notice that it is being requested more than 1 GB of available RAM on the smartphone to initialize. If the smartphone has less than 1 GB of available RAM, the plugin won't initialize and our app fails to launch.

System Info

Output of cordova info. Cordova Packages:

cli: 10.0.0
    common: 4.1.0
    create: 3.0.0
    lib: 10.1.0
        common: 4.1.0
        fetch: 3.1.0
        serve: 4.0.1

Project Installed Platforms:

android: 10.1.2

Project Installed Plugins:

cordova-clipboard: 1.2.1
cordova-plugin-advanced-http: 3.3.1
cordova-plugin-android-permissions: 1.1.5
cordova-plugin-androidx-adapter: 1.1.3
cordova-plugin-apprate: 1.4.0
cordova-plugin-calendar: 5.1.5
cordova-plugin-camera: 6.0.1-dev
cordova-plugin-cocoapod-support: 1.6.2
cordova-plugin-contacts: 3.0.1
cordova-plugin-crop: 0.3.1
cordova-plugin-datepicker: 0.9.3
cordova-plugin-device: 1.1.7
cordova-plugin-dialogs: 2.0.1
cordova-plugin-facebook-connect: 2.3.0
cordova-plugin-fcm-with-dependecy-updated: 7.8.0
cordova-plugin-file-opener2: 3.0.5
cordova-plugin-file-transfer: 2.0.0-dev
cordova-plugin-file: 6.0.1
cordova-plugin-firebase-analytics: 4.5.0
cordova-plugin-globalization: 1.11.0
cordova-plugin-http: 1.2.0
cordova-plugin-idfa: 2.0.0
cordova-plugin-inappbrowser: 4.1.0
cordova-plugin-inapppurchase-2: 1.3.0
cordova-plugin-ionic-keyboard: 2.2.0
cordova-plugin-nativestorage: 2.3.2
cordova-plugin-network-information: 2.0.2
cordova-plugin-purchase: 13.8.6
cordova-plugin-screen-orientation: 3.0.2
cordova-plugin-splashscreen: 4.1.0
cordova-plugin-statusbar: 2.4.3
cordova-plugin-wkwebview-file-xhr: 3.0.0
cordova-support-android-plugin: 1.0.2
cordova-support-google-services: 1.4.1
es6-promise-plugin: 4.2.2
ionic-plugin-keyboard: 2.2.1

Environment:

OS: macOS 13.6 (22G120) (darwin 22.6.0) x64
Node: v12.4.0
npm: 6.9.0

android Environment:

android:

ERROR: Command failed with exit code 1: android list target Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156) at com.android.repository.api.SchemaModule.(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.(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:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 5 more


The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager


Running /Users/fellipefonseca/Library/Android/sdk/tools/bin/avdmanager list target

Project Setting Files:

config.xml:

<?xml version='1.0' encoding='utf-8'?>

Salon Soft Aplicativo de salão de beleza. Fellipe Fonseca Light Salon Soft would like to have access to the photo gallery so that the app can upload photos when you want to put them in the register of clients, professionals and products, as well as to update your profile picture in the app. Your photos will not be shared without your permission. Salon Soft would like to access your calendar. Salon Soft would like to have access to the camera so that the app can upload photos when you want to put them in the register of clients, professionals and products, as well as to update your profile picture in the app. Your photos will not be shared without your permission. By allowing access to this data, you allow Salon Soft to: 1) Improve our products and services 2) Know how effective our advertisements are 3) Create advertisements for users similar to you. Salon Soft would like to access your contacts. Your data will not be shared without your permission.
package.json:

--- Start of Cordova JSON Snippet --- { "plugins": { "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "ionic-plugin-keyboard": {}, "cordova-plugin-datepicker": {}, "cordova-plugin-calendar": {}, "cordova-plugin-network-information": {}, "cordova-plugin-screen-orientation": {}, "cordova-plugin-crop": {}, "cordova-plugin-statusbar": {}, "cordova-clipboard": {}, "cordova-plugin-apprate": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-cocoapod-support": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-androidx-adapter": {}, "cordova-plugin-wkwebview-file-xhr": {}, "cordova-plugin-file-opener2": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, "cordova-plugin-idfa": { "ANDROID_PLAY_ADID_VERSION": "16.+" }, "cordova-plugin-facebook-connect": { "APP_ID": "221596308723733", "APP_NAME": "App Salon Soft", "FACEBOOK_URL_SCHEME_SUFFIX": " ", "FACEBOOK_AUTO_LOG_APP_EVENTS": "true", "FACEBOOK_HYBRID_APP_EVENTS": "false", "FACEBOOK_ADVERTISER_ID_COLLECTION": "true", "FACEBOOK_ANDROID_SDK_VERSION": "9.0.0", "FACEBOOK_IOS_SDK_VERSION": "9.0.1", "FACEBOOK_BROWSER_SDK_VERSION": "v9.0" }, "cordova-plugin-inapppurchase-2": {}, "cordova-plugin-contacts": {}, "cordova-plugin-file": {}, "cordova-plugin-file-transfer": {}, "cordova-plugin-http": {}, "cordova-plugin-advanced-http": { "ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1" }, "cordova-plugin-firebase-analytics": { "ANALYTICS_COLLECTION_ENABLED": "true", "AUTOMATIC_SCREEN_REPORTING_ENABLED": "true", "ANDROID_FIREBASE_ANALYTICS_VERSION": "17.5.+", "IOS_FIREBASE_ANALYTICS_VERSION": "~> 6.32.2" }, "cordova-plugin-camera": { "ANDROIDX_CORE_VERSION": "1.6.+" }, "cordova-plugin-android-permissions": {}, "cordova-plugin-fcm-with-dependecy-updated": { "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher", "ANDROID_FCM_VERSION": "23.0.0", "ANDROID_FIREBASE_BOM_VERSION": "29.0.1", "ANDROID_GOOGLE_SERVICES_VERSION": "4.3.4", "ANDROID_GRADLE_TOOLS_VERSION": "4.1.0", "IOS_FIREBASE_MESSAGING_VERSION": "~> 7.0.0" }, "cordova-plugin-purchase": {} }, "platforms": [ "android" ] }

j3k0 commented 7 months ago

Something makes you believe it's due to this plugin? I believe it would be better to report that issue to the cordova-android team.

fellipefonseca commented 7 months ago

Hi. Thanks for answering. This is because it started happening after updating to version 13 of the plugin

j3k0 commented 7 months ago

Do you have some crash report on Google Play publisher console, or logs from a device. Is your app waiting for the in-app purchase plugin to be initialized to show something on screen? Do you have a device that fails so you can get some logs?

Plugin isn't really memory hungry, it's just a 340 KB javascript file and doesn't keep much data in memory.

This is a first report so I doubt that the plugin would be responsible of that by itself (plugin being used by apps with hundred thousands of users), it would be interesting to gather more info or there isn't much to analyze...

fellipefonseca commented 7 months ago

Hi @j3k0

We don't have crash reports because the app just stays on an infinite white screen. I saw another issue from someone reporting that it couldn't work on ionic 3 (#1471), so I believe it's really because of the typescript version, but we wouldn't be able to update to v4 because ionic 3 doesn't support it and there wouldn't be time to version migration, as the Google Play deadline is November 1st. I tried to set a flag in tsconfig "skipLibCheck": true, which made it possible for me to compile and work on my cell phone, but these reports of a white screen occurred, including with another person on the team.

fellipefonseca commented 6 months ago

Solved here

aeharding commented 6 months ago

I think I may also be experiencing this white screen issue, because it started happening after I added in-app payments to my app. See https://github.com/aeharding/voyager/issues/946. I will try to investigate and get more logs.

aeharding commented 6 months ago

I can confirm that there is something weird going on with this lib, maybe some weird capacitor interaction that's causing Capacitor apps to sporadically not load (especially on iOS for my users). I resolved this by using revenue cat's plugin in https://github.com/aeharding/voyager/pull/951. I wish I could help debug this but there are zero errors to debug and its very sporadic. :( Sorry