Support for Android 12 (API level 31)
nunoarruda opened this issue · 5 comments
Description
This plugin fails to build in an Android project using the target SDK 31.
Expected behavior
Build successfully
Current behavior
Build fails
Logs
Manifest merger failed : android:exported needs to be explicitly specified for element <receiver#com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Environment
- Platform: Capacitor
- Kit: Push
- Kit Version 6.3.0-304
- OS Version Android 12
- Android Studio version (if applicable) 2021.2.1 Patch 1
com.huawei.hms:push:6.5.0.300 Fixed some issues for adapting to Android 12 (targetSdkVersion=31).
Before the new version of the plug-in released, as a workaround solution, you could manually modify the SDK version to com.huawei.hms:push:6.5.0.300
by following this guide.
Replacing com.huawei.hms:push:6.3.0.304
with com.huawei.hms:push:6.5.0.300
wasn't enough for me.
I also had to replace...
<receiver android:name="com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver">
With...
<receiver android:name="com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver" android:exported="true">
Now my Capacitor Android project builds successfully.
Please release a new version with these fixes when you have a chance. Thanks in advance.
@nunoarruda Thank you for providing the information regarding this issue, we'll record it and feedback to the R&D team, thanks.
Any news on this?
Versions 6.5.0.300 and 6.7.0.300 are already published for native projects, but I think what we need is the
Ionic Native/Cordova support: the@hmscore/cordova-plugin-hms-push
and @hmscore/ionic-native-hms-push
NPM packages (hopefully anything higher than the 6.3.0-304 version)
Hello @vjfuenzalida and @nunoarruda ,
Android API level 31 support has been added with the latest update of @hmscore/cordova-plugin-hms-push.
You can use this link to download the latest version of Huawei Cordova Push.
For more information about Huawei Cordova Push, you can access its official documentation via this link.