OneSignalDevelopers / OneSignal-Cordova-Example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUILD FAILED (Android) Error: ADMMessageHandler must extend

sync-by-unito opened this issue · comments

Description:
Hi, my Ionic/Cordova app can not be build with the last version of the OneSignal plugin. It works with cordova@8.1.0 (Android 28) but it does not work with cordova@10.0.0 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]

/Users/ararage/Documents/Projects/xxxxx/2019-2020/xxxxx/platforms/android/app/src/main/AndroidManifest.xml:14: 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

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.

┆Issue is synchronized with this Asana task by Unito

➤ Filippo Di Costanzo commented:

Same issue here

➤ Filippo Di Costanzo commented:

@ararage did u solve?

➤ Michał Kuklis commented:

I'm getting the same issue

Environmentonesignal-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]

/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.