OneSignal-Cordova-SDK
OneSignal-Cordova-SDK copied to clipboard
BUILD FAILED (Android) Error: ADMMessageHandler must extend
Description: Hi, my Ionic/Cordova app can not be build with the last version of the OneSignal plugin. It works with [email protected] (Android 28) but it does not work with [email protected] targeting Android 29, generating the signed APK throws strange errors related with the Amazon SDK and a corrupted APK.
Environment Cordova CLI : 10.0.0 OneSignal: 2.11.0 Android Target: 29 Ionic CLI: 6.11.1 Ionic Framework: @ionic/angular 4.7.4
Steps to Reproduce Issue: 1.- Add the onesignal-cordova-plugin to your project 2.- Build the project ($ ionic cordova build --release android)
Console Output:
cordova build android --release Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=/Users/ararage/Library/Android/sdk (DEPRECATED) Using Android SDK: /Users/ararage/Library/Android/sdk Reading build config file: /Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/build.json
BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details
Configure project :app WARNING: The onesignal-gradle-plugin MUST be before com.android.application! Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer! WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed in version 5.0 of the Android Gradle plugin. For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
Task :app:compileReleaseJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/platforms/android/app/src/main/java/org/apache/cordova/file/AssetFilesystem.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
Task :app:lintVitalRelease
/Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/platforms/android/app/src/main/AndroidManifest.xml:13: Error: ADMMessageHandler must extend android.app.Service [Instantiatable]
Explanation for issues of type "Instantiatable": Activities, services, broadcast receivers etc. registered in the manifest file (or for custom views, in a layout file) must be "instantiatable" by the system, which means that the class must be public, it must have an empty public constructor, and if it's an inner class, it must be a static inner class.
2 errors, 0 warnings
Task :app:stripReleaseDebugSymbols FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:stripReleaseDebugSymbols'. No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.3.6528147, 21.3.6528147
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 7s 42 actionable tasks: 42 executed Command failed with exit code 1: /Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/platforms/android/gradlew cdvBuildRelease -b /Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/platforms/android/build.gradle [ERROR] An error occurred while running subprocess cordova.
cordova build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Same issue here
@ararage did u solve?
I'm getting the same issue
Environment
onesignal-cordova-plugin: v2.11.1 cordova: 10.0.0 cordova-android: 9.0.0
/app/platforms/android/app/src/main/AndroidManifest.xml:27: Error: ADMMessageHandler must extend android.app.Service [Instantiatable]
<service android:exported="false" android:name="com.onesignal.ADMMessageHandler" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/app/platforms/android/app/src/main/AndroidManifest.xml:28: Error: Receiver must extend android.content.BroadcastReceiver [Instantiatable]
<receiver android:name="com.onesignal.ADMMessageHandler$Receiver" android:permission="com.amazon.device.messaging.permission.SEND">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "Instantiatable":
Activities, services, broadcast receivers etc. registered in the manifest
file (or for custom views, in a layout file) must be "instantiatable" by
the system, which means that the class must be public, it must have an
empty public constructor, and if it's an inner class, it must be a static
inner class.
I'm getting the same issue
Also confirming this issue with the same same environments as above.
I'll keep debugging but it would be great to receive some feedback on this issue, as the deadline for requiring API 29 is fast approaching!
I will add that debug apps build fine, this bug only occurs when building a signed release.
@ararage did u solve?
Unfortunately no :(
Duplicate of https://github.com/OneSignal/OneSignal-Android-SDK/issues/890
Please follow the issue there.
Once this is fixed on the native side. We will be able to put a release for Cordova.
Cheers
The fix from Issue890 did not resolve the original error: ADMMesssageHandler must extend.
Please assist.
@bbl-rpheredia The fix is in OneSignal-Android-SDK 4.0.0-beta2
. However this plugin (onesignal-cordova-plugin
) does not have a beta version yet using this native beta
Same issue exact here :)
Problem is also showing up in my project recently. I'm trying to build the Cordova project, but it is returning this error message
<user>@<computer> android % cordova run android --release -- --keystore=../android-certificates/keystore.jsk --storePassword='<password>' --alias=upload --password='<password>'
Discovered plugin "cordova-plugin-share". Adding it to the project
Plugin "nl.madebymark.share" already installed on android.
Plugin "nl.madebymark.share" already installed on ios.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/Users/<user>/Library/Android/sdk (recommended setting)
ANDROID_HOME=/Users/<user>/Library/Android/sdk (DEPRECATED)
Using Android SDK: /Users/<user>/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app
> Configure project :app
WARNING: The onesignal-gradle-plugin MUST be before com.android.application!
Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!
> Task :app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/<user>/Git/<project>/src-cordova/platforms/android/app/src/main/java/org/apache/cordova/file/AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :app:lintVitalRelease
/Users/<user>/Git/<project>/src-cordova/platforms/android/app/src/main/AndroidManifest.xml:41: Error: ADMMessageHandler must extend android.app.Service [Instantiatable]
<service android:exported="false" android:name="com.onesignal.ADMMessageHandler"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/<user>/Git/<project>/src-cordova/platforms/android/app/src/main/AndroidManifest.xml:43: Error: Receiver must extend android.content.BroadcastReceiver [Instantiatable]
<receiver android:name="com.onesignal.ADMMessageHandler$Receiver" android:permission="com.amazon.device.messaging.permission.SEND">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "Instantiatable":
Activities, services, broadcast receivers etc. registered in the manifest
file (or for custom views, in a layout file) must be "instantiatable" by
the system, which means that the class must be public, it must have an
empty public constructor, and if it's an inner class, it must be a static
inner class.
2 errors, 0 warnings
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 33s
44 actionable tasks: 44 executed
Result of cordova requirements android
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-30,android-29,android-28,android-22
Gradle: installed /usr/local/Cellar/gradle/6.7/bin/gradle
Please help 😅
Error happening here too, Any news?
Howdy, This will be resolved when the major release for the OneSignal Cordova SDK goes into beta. Thanks for your patience
@rgomezp,
This is good news, thank you. Is there an estimated time of completion?
Any news? The problem remains for me.
We didn't have errors nor warnings on the installation of "com.onesignal.ADMMessageHandler" service.
But I think this service can access location data from background in some conditions (if the app has the location access permissions in the manifest and the minimum Android version supported is < 8.0 with target SDK 30).
With the new Play Store rules, you have to declare which "sensitive" feature your app uses, in foreground and/or in background. This service causes the detection of a "background location access" and you need to justify it (even with a demo video).
We had to manually remove the service from the manifes, in order to achieve a successful review.
Howdy, Unfortunately this won't be released until some time in the new year. Thanks everyone for your patience. I will leave this one open in this repository for tracking purposes.
@Meow8p Thanks for the details
any update please?
No update yet @HIMSAI724 . I have bumped the priority to Medium, however.
Thanks everyone for your patience.
So basically the new major release does not support Amazon yet? Is there an estimation for the fix?
+1
Any update?
Since I updated the cordova plugin android to 10.0.0 I also have this problem Is there a solution to this?
Hello are folks still experiencing this issue in the 3.0.1 version of the SDK?
+1