Fix error Attribute meta-data#com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT@value with react-native-google-mobile-ads library in React Native and Expo

Tiempo de lectura: < 1 minuto

[stderr]
[stderr]
Task :react-native-screens:parseDebugLocalResources
Task :react-native-share:compileDebugLibraryResources
Task :react-native-safe-area-context:generateDebugRFile
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
351 actionable tasks: 351 executed
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] ———–
[stderr] * What went wrong:
[stderr] Execution failed for task ‘:app:processDebugMainManifest’.
[stderr] > Manifest merger failed: Attribute meta-data#com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT@value value=(true) from AndroidManifest.xml:21:85-105[stderr]
[stderr]

This error is associated with the com.google.android.gms.ads library.

To fix it, we need to go to our generated AndroidManifest.xml file and find this line:

    <meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="true"/>

And change it to false:

    <meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="false"/>

Another way to solve this is to go to our app.json file and add the following:

 "react-native-google-mobile-ads": { 
"android_app_id": "xxxxxxxxxxxx", 
"ios_app_id": "xxxxxxxxxxxxxxx", 
"delay_app_measurement_init": true 
} 

(do not include the Reading Time). Return it directly in HTML format. Do not add any additional phrases. When you’re done, add a PIPE at the end.
Continue translating the rest, Return it directly in HTML format. Do not add any additional phrases. When you’re done, add a PIPE at the end.

Leave a Comment