cordova-plugin-push: Build failing on Android 10.0.1 and iOS 6.2.0
Bug Report
Build failing on Android 10.0.1 and iOS 6.2.0
Expected Behaviour
Build should complete.
Actual Behaviour
When I add the @havesource/cordova-plugin-push plugin to the project the build fails.
Reproduce Scenario (including but not limited to)
Try to build for android or iOS after adding this Plugin.
I tried adding the cordova-plugin-androidx-adapter Plugin and adding <preference name="AndroidXEnabled" value="true" /> to my config.xml. The problem persists.
Steps to Reproduce
Create new project, add platforms, the plugin and try to build:
cordova create pushError
cordova platform add android@10.0.1
cordova platform add ios@6.2.0
cordova plugin add @havesource/cordova-plugin-push
cordova build android
cordova build ios
Platform and Version
Cordova CLI 10.0.0 Android 10.0.1 iOS 6.2.0
cordova info Printout
Cordova Packages:
cli: 10.0.0
common: 4.0.2
create: 3.0.0
lib: 10.0.0
common: 4.0.2
fetch: 3.0.0
serve: 4.0.0
Project Installed Platforms:
android: 10.0.1
ios: 6.2.0
Project Installed Plugins:
@havesource/cordova-plugin-push: 2.0.0
cordova-plugin-whitelist: 1.3.5
Environment:
OS: macOS 11.5.1 (20G80) (darwin 20.6.0) x64
Node: v12.18.0
npm: 6.14.8
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.<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:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) … 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/imperyal_dev/Library/Android/sdk/tools/bin/avdmanager list target
ios Environment:
xcodebuild:
Xcode 12.5.1 Build version 12E507
Project Setting Files:
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</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:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
package.json:
— Start of Cordova JSON Snippet — { “plugins”: { “cordova-plugin-whitelist”: {} }, “platforms”: [ “android”, “ios” ] } — End of Cordova JSON Snippet —`
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21
@joeldhenry I agree.
@erisu could you please release 3.0.0 prod version for android?
Hello,
I managed to create a build with
"@havesource/cordova-plugin-push": "^2.0.0"and"cordova-android": "^10.1.1". Before that, I was using"phonegap-plugin-push": "2.3.0"and"cordova-android": "^9.0.0".Changes that I made:
"@havesource/cordova-plugin-push": { "ANDROID_SUPPORT_V13_VERSION": "27.+", "FCM_VERSION": "18.0.+", "IOS_FIREBASE_MESSAGING_VERSION": "~> 6.32.2" },npm i<preference name="GradlePluginGoogleServicesVersion" value="4.3.8"/>This is used by @havesource/cordova-plugin-push. This parameter is already present in the plugin.xml of the plugin but with version 4.2.0<plugin name="cordova-plugin-whitelist" spec="1.3.3"/><plugin name="phonegap-plugin-push" spec="2.0.0"/>with<plugin name="@havesource/cordova-plugin-push" spec="2.0.0"/><style name="SplashTheme" parent="android:style/Theme.DeviceDefault.NoActionBar">with<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">. The app was crashing at startup without this change.npm inpm iNote: cordova-android 10.x will genetrate .aab file by default for release builds. If you want .apk file, you should add the following flag to ionic cordova build command:
-- -- --packageType=apkHope this will help you.
Later edit
Android Studio Arctic Fox | 2020.3.1 Patch 3 Build #AI-203.7717.56.2031.7784292, built on October 1, 2021 Android SDK Build-Tools: 30.0.3 Gradle: 7.1.1 Cordova CLI: 10.0.0
@erisu this is now a high priority as google now requires SDK 30, which means android-sdk 10 is requirement and this plugin is blocking updates to the app store. i have had to temporarily manually bump up the target sdk to 30.
Any ETA for the release plan for 3.0.0-dev version?
@erisu It would be helpful if you could release a minor version to add support for android 10.x or later versions. Otherwise it will be a blocker and it enforce us to migrate to other push plugins which is tedious work to do.
Thanks
Yes, it works perfect with 3.0.0-dev.1 version.
Hello,
@mahen23 New ionic project with cordova-android 10.1.1 works fine if you remove the plugin “cordova-plugin-whitelist”. The funtionality of this plugin was added in cordova-android.
The problem is when adding @havesource/cordova-plugin-push.
@erisu Can you please let us know if we can use the
<preference name="android-targetSdkVersion" value="30"/>in cordova-android 9.0.0 so we can comply with Google requirements?From November 2021, updates to existing apps will be required to target API level 30 or above and adjust for behavioral changes in Android 11. Existing apps that are not receiving updates are unaffected and can continue to be downloaded from the Play Store.
Thanks for your response! Yes I ment 3.0.0-dev.1. i guess its up to you and your preferences, but i think lots of other people will have the same issue as android requires us to upgrade. 3.0.0-dev.1 works great on cordova-android 10.1.1 in my testing
I got the same problem with android 10.1.0:
I found this: https://stackoverflow.com/questions/67948855/some-problems-were-found-with-the-configuration-of-task-appprocessdebuggoogle
in plugins/@havesource/cordova-plugin-push/plugin.xml set GradlePluginGoogleServicesVersion to 4.3.8
rebuild:
This fixes one problem. Still, I did not get it to build for me. Looks like there is still a lot to do for cordova-android 10.
Anyway, I uninstalled build tools 31 but keep 30.0.3 and moved back to cordova-android 9.0.0:
Works for me, now. Note: I still have GradlePluginGoogleServicesVersion 4.3.8 in the plugin.xml and my own config.xml