0

I'm building my App using "npx eas-cli build --profile development" but it keeps on failing at gradle with the error below, It builds successfully on IOS without any Issue. At first I thought the issue was with my project but when I remove "react-native-google-mobile-ads" it builds successfully without any issue. so it looks like "react-native-google-mobile-ads" is causing the failure. Please am I missing something or Its a general issue? base on this line

"Attribute meta-data#com.google.android.gms.ads.APPLICATION_ID@value value=(ca-app-pub-3940256099942544~3347511713) from AndroidManifest.xml:27:73-127"

in the gradle error,it is showing the id above which is not the Android app id I provided in the app.js

package.json:

    "react": "18.2.0",
    "react-native": "0.71.7",
    "expo": "48.0.0",
    "react-native-google-mobile-ads": "^10.3.2",

app.json:

    { 
      "expo":{},
      "react-native-google-mobile-ads": {
        "android_app_id": "my Admob android app id",
        "ios_app_id": "my Admob iOS app id" 
      }
    }

Gradle Error

[stderr] /home/expo/workingdir/build/android/app/src/debug/AndroidManifest.xml:27:73-127 Error: 
[stderr] Attribute meta-data#com.google.android.gms.ads.APPLICATION_ID@value value=(ca-app-pub-3940256099942544~3347511713) from AndroidManifest.xml:27:73-127 
[stderr] is also present at [:react-native-google-mobile-ads] AndroidManifest.xml:14:13-67 value=(ca-app-pub-7326900831199527~1591451448). 
[stderr] Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:27:5-129 to override. 
[stderr] /home/expo/workingdir/build/android/app/src/debug/AndroidManifest.xml:28:85-105 Error: 
[stderr] Attribute meta-data#com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT@value value=(true) from AndroidManifest.xml:28:85-105 
[stderr] is also present at [:react-native-google-mobile-ads] AndroidManifest.xml:17:13-34 value=(false). 
[stderr] Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:28:5-107 to override. > Task :expo:generateDebugRFile > Task :react-native-fast-image:generateDebugRFile > Task :react-native-device-info: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 373 actionable tasks: 373 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 with multiple errors, see logs 
[stderr] * Try: 
[stderr] > Run with --stacktrace option to get the stack trace. 
[stderr] > Run with --info or --debug option to get more log output. 
[stderr] > Run with --scan to get full insights. 
[stderr] ============================================================================== 
[stderr] 2: Task failed with an exception. 
[stderr] 
[stderr] * What went wrong: 
[stderr] java.lang.StackOverflowError (no error message) 
[stderr] * Try: 
[stderr] > Run with --stacktrace option to get the stack trace. 
[stderr] > Run with --info or --debug option to get more log output. 
[stderr] > Run with --scan to get full insights. 
[stderr] ============================================================================== 
[stderr] * Get more help at https://help.gradle.org 
[stderr] BUILD FAILED in 4m 23s 

I have tried downgrading to different react-native-google-mobile-ads versions but all failed to build too. I have. also tried building with the --clear-cache flag

bagi2info.com
  • 408
  • 1
  • 3
  • 11
Johndev247
  • 91
  • 6
  • please share your package.json and you app.json? – bagi2info.com May 17 '23 at 07:10
  • @bagi2info.com I have shared the minimal version above, just that the post is not well formatted. or should I share the complete content of both files? please help me. my app is ready for deployment and I really need to use ads. thanks. – Johndev247 May 17 '23 at 11:33
  • Seems like you have other ads library, I wanna check your config, I use the same ads, no issue – bagi2info.com May 17 '23 at 12:38
  • @bagi2info.com Thank you very much for bringing my attention to this. I actually used admob before it was deprecated, I added the the google ads id in app.json under android, I forgot to remove that key pair after migrating react-native-google-mobile-ads. I removed it now and it builds successfully. Thanks once again, I really appreciate. – Johndev247 May 17 '23 at 15:07

0 Answers0