Build error with plugin @hmscore/cordova-plugin-hms-push for Huawei Push Notification

Hello,

I am trying to build a cordova application with Huawei Push Notification together with OneSignal plugin, but unfortunately voltbuilder cannot build the test apk for Android. Some additional infos:

  1. I am trying to build for android 12, so I followed the documentation.
  2. IOS test builds and Android test builds are working great, also push notification (through onesignal plugin) are working.The same apk, uploaded on my huawei device, work well (except for push notification).
  3. The problem arises when I include in the config.xml the following:
  <plugin name="@hmscore/cordova-plugin-hms-push" spec="6.3.0-304" />

In voltbuilder.log, this is the problem reported:

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> 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.
See log for full details.
2022-12-20 14:54:50,883 - Build failed f8fcd257-2fd2-493f-b920-bfb9206b44e7
2022-12-20 14:54:52,000 - Output: 

This is strange, as I did everything explained in the documentation, particullary:

  1. Added <engine name="android" spec="11.0.0" />
  2. Added <preference name="AndroidXEnabled" value="true" />
  3. Checked all plugins are up to date
  4. In platform android, I added:
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity" >
      <application android:exported="true"/>
    </edit-config>

But it still won’t build. Any idea on how to resolve this? I can attach the voltbuilder.log if it can help.

Thank you very much to anyone who will help me!

You shouldn’t need the edit-config section. Also, try adding this:

<platform name="android">
     ...
     <preference name="android-targetSdkVersion" value="32" />
     <preference name="android-compiledSdkVersion" value="32" />
</platform>

Hi, thank you very much for your answer! I tryied to do as you said, unfortunately still error in the build.

The error is the same, here is the voltbuilder.log file:

voltbuilder.log

Looks like it is a known issue with the plugin.

Yes, seems like, found an issue on the github page of the plugin:

I will try to make it work by using edit-config, otherwise I’ll be forced to wait until the plugin is updated or just try to build locally modifying the manifest by myself…

Thank you anyway for your time

You could also fork it and submit your own version to Volt. The fix is shown by one of the people that replied to that. Crazy that they haven’t accepted the pull request.

android-compileSdkVersion not android-compiledSdkVersion