Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raulnsuarez opened this issue Apr 19, 2023 · 4 comments

Comments

@raulnsuarez
Copy link

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

@hamza-mubeen-07
Copy link

I am also facing the same error while trying to create APK. I tried your solution but it did not work for me at all.

@raulnsuarez
Copy link
Author

If manipulate the plugin.xml doesn't work for you, you can manually update the AndroidManifest.xml file in android\capacitor-cordova-android-plugins\src\main and define android:exported=false in the receiver key, at least this works for me.
Here it's what its looks like for me:
image

I am also facing the same error while trying to create APK. I tried your solution but it did not work for me at all.

@hamza-mubeen-07
Copy link

Thanks this worked for me.

@addahlbe
Copy link

It looks like someone updated this 6 months ago, but there has not been a package update since the change was made. Can you please publish the project with a new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants