secrets-gradle-plugin: Merged Manifest error
So I followed this guide from the Maps SDK to add the API key to the app.
Now in Android Studio the Merged Manifest view no longer works which in turn also breaks the MissingPermission
lint.
Android Studio shows this error when viewing the Merged Manifest:
Merging Errors: Error: Attribute meta-data#com.google.android.geo.API_KEY@value at AndroidManifest.xml:57:13-44 requires a placeholder substitution but no value for <MAPS_API_KEY> is provided. redacted.app main manifest (this file), line 56 Error: Validation failed, exiting redacted.app main manifest (this file)
MissingPermission
lint warning, despite the permissions being in AndroidManifest.xml
:
Missing permissions required by FusedLocationProviderClient.requestLocationUpdates: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
A workaround would be to manually add manifestPlaceholders = [MAPS_API_KEY: ""]
to the app build.gradle, but this feels wrong.
Is there a better way to avoid this, or is this more an error by Android Studio or the Android Gradle plugin?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 15
Commits related to this issue
- Try to repro #41 — committed to google/secrets-gradle-plugin by arriolac 2 years ago
The issue is still there, though AS is now able to display the merged manifest even if there are errors.
AGP version 7.2.2 Gradle Version 7.3.3
Steps to repro
Have a Manifest with Any Android Permission for example
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />Follow steps given in the google link above and change the meta data accordingly
A Sample piece of code
Workaround
A simple workaround is to define a manifest placeholder in the build.gradle(app module) file.
However as this is not mentioned anywhere in the samples/documentation i believe this is a bug.
Correct, I have a
MAPS_API_KEY
inlocal.properties
that I’m using in theAndroidManifest.xml
like so${MAPS_API_KEY}
. Everything compiles correctly, Maps is working in the app, so the value is applied. But there are still the errors I wrote above. No configurations options.