Skip to content

Plugging getting error for Android 12 due to :capacitor-cordova-android-plugins:processReleaseManifest execution failed #614

@raulnsuarez

Description

@raulnsuarez

Hello,
I'm working on Ionic Framework using Capacitor. When I try to perform the assembleRelease the build process gets stopped by a failure in the :capacitor-cordova-android-plugins:processReleaseManifest task:

Task :capacitor-cordova-android-plugins:processReleaseManifest FAILED
C:\Users\rsuarez\source\repos\Incentive\android\capacitor-cordova-android-plugins\src\main\AndroidManifest.xml:6:1-10:12 Error:
android:exported needs to be explicitly specified for element <receiver#com.google.android.gms.analytics.AnalyticsReceiver>. 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 http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':capacitor-cordova-android-plugins:processReleaseManifest'.

A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
Manifest merger failed : android:exported needs to be explicitly specified for element <receiver#com.google.android.gms.analytics.AnalyticsReceiver>. 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.


I set the "android:export=false" statement in the receiver index inside the AndroidManifest and the build process finally succeeds. The real issue is when I try to update the web assets to the Android project using "npx cap copy" the AndroidManifest is reset. I found a way to avoid this issue by updating manually the plugin.xml file in your module and adding the "android:exported" to the receiver key. Anyway, this fixes my local environment but I'm using Ionic's AppFlow to Release the App to the Play Store and the build process is fully automatic, so the manual update of the plugin.xml is not an alternative. I would like to evaluate this solution if it's possible, and if it's right and makes sense, create a fix for this. Of course, I'm not an expert and maybe this can't be performed the way I think, If this is the case, please can you tell me a way to win this situation? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions