Skip to content

[🐛] Bug Report Title - EAS Android build issue 14.10.0 gma_ad_services_config.xml #722

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

Open
1 task
workbyken opened this issue Mar 15, 2025 · 21 comments
Open
1 task
Labels
help wanted Extra attention is needed

Comments

@workbyken
Copy link

What happened?

EAS Android Build is failing:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR: /home/expo/workingdir/build/node_modules/react-native-google-mobile-ads/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml:42:9-45:48: AAPT: error: resource xml/gma_ad_services_config

I tried creating that file and copying it with EAS build pre install but still doesn't work:

"eas-build-pre-install": "npm config set legacy-peer-deps true && mkdir -p $PWD/android/app/src/main/res/xml && cp $PWD/gma_ad_services_config.xml $PWD/android/app/src/main/res/xml/gma_ad_services_config.xml"

Platforms

Android, but have not tested behavior on iOS

React Native Info

Creating new worker instance
AMD, 4 vCPUs, 16 GB RAM
Using image "ubuntu-22.04-jdk-17-ndk-26.1.10909125" based on "ubuntu-2204-jammy-v20250112"
Installed software:
- NDK 26.1.10909125
- Node.js 18.18.0
- Bun 1.1.43
- Yarn 1.22.21
- pnpm 9.15.4
- npm 9.8.1
- Java 17
- node-gyp 10.2.0
Resolved builder image to 'sdk-52'.

EAS Build environment variables:
  SHELL=/bin/sh
  NVM_INC=/home/expo/.nvm/versions/node/v18.18.0/include/node
  JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
  PWD=/usr/local/eas-build-worker
  LOGNAME=expo
  SYSTEMD_EXEC_PID=847
  HOME=/home/expo
  LANG=en_US.UTF-8
  INVOCATION_ID=c6f8678e30f2435eac03427bb3155f12
  ANDROID_NDK_HOME=/home/expo/Android/Sdk/ndk/26.1.10909125
  NVM_DIR=/home/expo/.nvm
  ANDROID_HOME=/home/expo/Android/Sdk
  USER=expo
  SHLVL=0
  ANDROID_SDK_ROOT=/home/expo/Android/Sdk
  JOURNAL_STREAM=8:4846
  PATH=/home/expo/workingdir/bin:/home/expo/.nvm/versions/node/v18.18.0/bin:/opt/bundletool:/home/expo/Android/Sdk/build-tools/29.0.3:/home/expo/Android/Sdk/ndk/26.1.10909125:/home/expo/Android/Sdk/cmdline-tools/tools/bin:/home/expo/Android/Sdk/tools:/home/expo/Android/Sdk/tools/bin:/home/expo/Android/Sdk/platform-tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/expo/.bun/bin
  LOGGER_LEVEL=info
  NVM_BIN=/home/expo/.nvm/versions/node/v18.18.0/bin
  EAS_BUILD_WORKER_DIR=/home/expo/eas-build-worker
  _=/home/expo/.nvm/versions/node/v18.18.0/bin/node
  CI=1
  MAESTRO_DRIVER_STARTUP_TIMEOUT=120000
  MAESTRO_CLI_NO_ANALYTICS=1
  EAS_BUILD=true
  EAS_BUILD_PLATFORM=android
  NVM_NODEJS_ORG_MIRROR=http://10.4.0.203:8081
  EAS_BUILD_PROFILE=development

Are your using Typescript?

  • My project is using Typescript

package.json

"react-native-google-mobile-ads": "^14.10.0",

app.json

"expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "15.5"
          },
          "android": {
            "kotlinVersion": "1.9.25",
            "gradleProperties": {
              "android.useAndroidX": "true",
              "android.enableJetifier": "true"
            },
            "compileSdkVersion": 34,
            "targetSdkVersion": 34,
            "minSdkVersion": 24
          }
        }

ios/Podfile

android/build.gradle

android/app/build.gradle

android/settings.gradle

AndroidManifest.xml

@workbyken workbyken added the help wanted Extra attention is needed label Mar 15, 2025
@pjohn71
Copy link

pjohn71 commented Mar 15, 2025

i am experiencing the same issue

@ajouve
Copy link

ajouve commented Mar 15, 2025

Looks like AD_SERVICES_CONFIG has to be removed

https://stackoverflow.com/questions/79469231/play-services-ads24-0-0-resource-xml-gma-ad-services-config-not-found

I try to go back to 14.9.1 and I still have the same error

@egiesem
Copy link

egiesem commented Mar 15, 2025

same here

@dylancom
Copy link
Collaborator

Try 14.10.1

@gabrielcantarin2
Copy link

same here

@jplandry908
Copy link

Looks like AD_SERVICES_CONFIG has to be removed

https://stackoverflow.com/questions/79469231/play-services-ads24-0-0-resource-xml-gma-ad-services-config-not-found

I try to go back to 14.9.1 and I still have the same error

FYI - I had to go back to '14.9.0' to remove the error.

@marcshilling
Copy link

marcshilling commented Mar 22, 2025

Not sure if this is related but I also had to downgrade to get past this. At first on 14.10.1 I was getting this same error, then I commented out the gma_ad_services_config remove entry in my manifest and was getting a different error about Kotlin version incompatibility.

It works for me again on 14.9.1, still without the gma_ad_services_config remove entry in my manifest

@dylancom
Copy link
Collaborator

dylancom commented Mar 24, 2025

We now have 14.11.0 released which reverts upgrading to Android SDK 24.1.0, as this requires kotlin 2.0.0 (a breaking change).
For those using Kotlin 2.0.0, you can upgrade to v15.

@marcshilling
Copy link

We now have 14.11.0 released which reverts upgrading to Android SDK 24.1.0, as this requires kotlin 2.1.0 (a breaking change). For those using Kotlin 2.1.0, you can upgrade to v15.

Thanks @dylancom! Can confirm this fixed my issues and I'm able to build without the gma_ad_services_config remove entry in my manifest

@mikehardy
Copy link
Collaborator

mikehardy commented Mar 24, 2025

Android Manifest ad services config tools:remove stuff

Just a note for people using v23 of play-services-ads SDK (which is what you'll get with the v14.x series here), as far as I understand:

  • you may need the remove entry in AndroidManifest.xml for AD_SERVICES_CONFIG
  • you may not need the remove entry

As far as I know, the only factor determining whether you need it or not is if you use other packages which also include it (1 is fine, 2 or more cause a build error)

Known collisions are @react-native-firebase/analytics and react-native-fbsdk-next as they also include that AndroidManifest entry. (ask me how I know this? I maintain those two packages as well as help maintain this one, I've handled the related issues...). There may be others...

So if you don't need it, fantastic! And with v24 of our native SDK / v15 version series here, you won't need it ever again which is nice

But on v14 here / v23 of the native android SDK you might need that AndroidManifest trick, and no other person can tell you whether you will or not without looking at your package.json and maybe not even then if they don't know all those packages deeply...

Accessing the new SDK if you want

Many thanks to Dylan for mopping up the inadvertent mess - a bit subtle of Google to slip in a binary-incompatible change with their compiler toolchain here.

I will note for anyone that wants to use the new Android ads SDK v24, via the v15 release here, it only requires one patch to react-native's built-in android gradle plugin to be compatible with kotlin 2.1, and the patch applies via patch-package back to react-native 0.76 at least. The fix will aslo be in the react-native 0.79 release that's coming up soon as well, so v15+ here will be accessible in combination with react-native 0.79 as soon as it is out.

Here's the patch until then - this is already on react-native main and release-0.79 branches upstream:

https://github.com/invertase/react-native-google-mobile-ads/blob/main/RNGoogleMobileAdsExample/patches/%40react-native%2Bgradle-plugin%2B0.76.5.patch

@zguo123
Copy link

zguo123 commented Mar 25, 2025

@mikehardy Thank you so much for the fix! However, I cannot find it as it shows a 404 error page:

Image

@dylancom
Copy link
Collaborator

dylancom commented Mar 25, 2025

@mikehardy found later that upgrading to 2.0.0 (instead of 2.1.0) is enough, which doesn't require a patch!
Therefore I updated our example and removed the patch also.

See: https://docs.page/invertase/react-native-google-mobile-ads/migrating-to-v15

@zguo123
Copy link

zguo123 commented Mar 25, 2025

I would love some guidance on how to do it for expo as the expo-modules-core package still uses Koltin 1.9.25 in some cases.

@mikehardy
Copy link
Collaborator

mikehardy commented Mar 25, 2025

@zguo123 I think you want https://docs.expo.dev/versions/latest/sdk/build-properties/, you set the kotlinVersion one (it's nested, you'll have to read the docs...) and an expo prebuild

A success report and config file snippet if it works would probably be a huge help for future people!

@zguo123
Copy link

zguo123 commented Mar 25, 2025

Thanks!

I have installed expo-build-properties:

Config:

package.json

{
   ...., 
   "expo-build-properties": "~0.13.2",
}

app.config.ts

...
    [
      "expo-build-properties",
      {
        android: {
          kotlinVersion: "2.0.0",
          
        },
       ...
      },
    ],

Running eas build --platform android --profile preview --local returns this:

[RUN_GRADLEW] Could not determine the dependencies of task ':expo-modules-core:compileReleaseKotlin'.
[RUN_GRADLEW] > Could not resolve all dependencies for configuration ':expo-modules-core:kotlin-extension'.
[RUN_GRADLEW]    > Could not find org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:1.9.25.

@mikehardy
Copy link
Collaborator

@zguo123 the hazards of attempting to troubleshoot without having a fully reproducible minimal example.
Your build properties snippet looks correct though could be wrong and not taking affect somehow, or perhaps it needs to be specified somewhere else as well

I wonder if you are not on an outdated version of Expo though, they have definitely done "kotlin 2" compatibility work, see this https://github.com/expo/expo/pull/34500/files#diff-dcab4f253e7efe2ec641357ce996a56297c9b64ed9ef5ce4b2e7ae571263d8af

It appears you may be on Expo SDK 51, and you need to be on SDK52 which I believe comes with kotlin 2+ by default

@mikehardy
Copy link
Collaborator

(I don't use Expo though, so could be wrong about everything, if so, very sorry)

@zguo123
Copy link

zguo123 commented Mar 25, 2025

@mikehardy Ah its aboslutely okay! i am using Expo version 52 and it is still not working. For now, I am downgrading to 14.11.0 and I will get an example working

@mikehardy
Copy link
Collaborator

@zguo123 I would bring this up with Expo in an issue there - this seems like something that should work and you're pretty current. There must be some little trick missing somehow / someway I just don't know what

@zguo123
Copy link

zguo123 commented Mar 25, 2025

@mikehardy thanks so much! I will troubleshoot as well

@zguo123
Copy link

zguo123 commented Apr 4, 2025

found this comment:

#728 (comment)

turns out you need react native 0.77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants