invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
702 stars 142 forks source link

[🐛] Build failing after upgrade to Expo 51 #595

Closed thomasread99 closed 2 months ago

thomasread99 commented 4 months ago

What happened?

I have recently updated my project to expo 51, but when I go to build the development client it fails at the run gradlew stage with the following error:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-google-mobile-ads:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

The iOS development client builds fine. I am building the development clients with EAS. Any ideas?

Platforms

Only on Android

React Native Info

info Fetching system and libraries information...
System:
  OS: Windows 11 10.0.22631
  CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-1360P
  Memory: 5.26 GB / 15.62 GB
Binaries:
  Node:
    version: 20.12.2
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 10.8.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.10.35013.160 (Visual Studio Community 2022)
Languages:
  Java: Not Found
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.2
    wanted: 0.74.2
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Are your using Typescript?

package.json

{
  "name": "my-app",
  "version": "3.2.1",
  "main": "./index.ts",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@growthbook/growthbook-react": "^0.21.0",
    "@microsoft/applicationinsights-react-native": "^4.1.1",
    "@microsoft/applicationinsights-web": "^3.2.0",
    "@morrowdigital/watermelondb-expo-plugin": "^2.3.1",
    "@nozbe/watermelondb": "^0.27.1",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/datetimepicker": "8.0.1",
    "@react-native-firebase/analytics": "^18.6.1",
    "@react-native-firebase/app": "^18.6.1",
    "@react-native-google-signin/google-signin": "^11.0.0",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/stack": "^6.3.20",
    "@reduxjs/toolkit": "^1.9.7",
    "axios": "^1.7.2",
    "bson": "^6.3.0",
    "core-js": "3.37.1",
    "expo": "^51.0.16",
    "expo-barcode-scanner": "~13.0.1",
    "expo-build-properties": "~0.12.3",
    "expo-dev-client": "~4.0.19",
    "expo-font": "~12.0.7",
    "expo-linking": "~6.3.1",
    "expo-network": "~6.0.1",
    "expo-notifications": "~0.28.9",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-store-review": "~7.0.2",
    "expo-tracking-transparency": "~4.0.2",
    "jwt-decode": "^4.0.0",
    "moment": "^2.30.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.2",
    "react-native-confirmation-code-field": "^7.3.2",
    "react-native-device-info": "^10.13.2",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-get-random-values": "~1.11.0",
    "react-native-google-mobile-ads": "^12.11.0",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "4.10.1",
    "react-native-screens": "3.31.1",
    "react-native-toast-message": "^2.2.0",
    "react-native-uuid": "^2.0.1",
    "react-native-web": "~0.19.10",
    "react-redux": "^8.1.2",
    "typescript": "^5.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
    "@types/react": "~18.2.79",
    "@typescript-eslint/eslint-plugin": "^5.60.0",
    "@typescript-eslint/parser": "^5.62.0",
    "eslint": "^8.57.0",
    "eslint-plugin-react": "^7.34.3"
  },
  "private": true
}

app.json

{
  "expo": {
    "name": "MyApp",
    "slug": "my-app",
    "version": "3.2.1",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "owner": "myapp",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "BUNDLE_ID",
      "buildNumber": "1",
      "infoPlist": {
        "NSCameraUsageDescription": "This app uses the camera."
      },
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "package": "PACKAGE_ID",
      "versionCode": 58,
      "googleServicesFile": "./google-services.json",
      "permissions": [
        "com.google.android.gms.permission.AD_ID"
      ]
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "extra": {
      "eas": {
        "projectId": "0e4ef499-3b0f-48fd-a8a2-aa8a2d042a1c"
      }
    },
    "plugins": [
      [
        "expo-notifications",
        {
          "icon": "./assets/notification-icon.png",
          "color": "#086788"
        }
      ],
      [
        "expo-build-properties",
        {
          "android": {
            "extraProguardRules": "-keep class com.google.android.gms.internal.consent_sdk.** { *; }",
            "kotlinVersion": "1.6.10",
            "packagingOptions": {
              "pickFirst": [
                "**/libc++_shared.so"
              ]
            }
          },
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      [
        "expo-tracking-transparency",
        {
          "userTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ],
      "@react-native-firebase/app",
      "expo-font",
      "@react-native-google-signin/google-signin",
      [
        "@morrowdigital/watermelondb-expo-plugin"
      ]
    ],
    "platforms": [
      "ios",
      "android"
    ]
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "app_id",
    "ios_app_id": "app_id",
    "sk_ad_network_items": [
      "cstr6suwn9.skadnetwork",
      "4fzdc2evr5.skadnetwork",
      "4pfyvq9l8r.skadnetwork",
      "2fnua5tdw4.skadnetwork",
      "ydx93a7ass.skadnetwork",
      "5a6flpkh64.skadnetwork",
      "p78axxw29g.skadnetwork",
      "v72qych5uu.skadnetwork",
      "ludvb6z3bs.skadnetwork",
      "cp8zw746q7.skadnetwork",
      "c6k4g5qg8m.skadnetwork",
      "s39g8k73mm.skadnetwork",
      "3qy4746246.skadnetwork",
      "3sh42y64q3.skadnetwork",
      "f38h382jlk.skadnetwork",
      "hs6bdukanm.skadnetwork",
      "prcb7njmu6.skadnetwork",
      "v4nxqhlyqp.skadnetwork",
      "wzmmz9fp6w.skadnetwork",
      "yclnxrl5pm.skadnetwork",
      "t38b2kh725.skadnetwork",
      "7ug5zh24hu.skadnetwork",
      "9rd848q2bz.skadnetwork",
      "y5ghdn5j9k.skadnetwork",
      "n6fk4nfna4.skadnetwork",
      "v9wttpbfk9.skadnetwork",
      "n38lu8286q.skadnetwork",
      "47vhws6wlr.skadnetwork",
      "kbd757ywx3.skadnetwork",
      "9t245vhmpl.skadnetwork",
      "a2p9lx4jpn.skadnetwork",
      "22mmun2rn5.skadnetwork",
      "4468km3ulz.skadnetwork",
      "2u9pt9hc89.skadnetwork",
      "8s468mfl3y.skadnetwork",
      "av6w8kgt66.skadnetwork",
      "klf5c3l5u5.skadnetwork",
      "ppxm28t8ap.skadnetwork",
      "424m5254lk.skadnetwork",
      "ecpz2srf59.skadnetwork",
      "uw77j35x4d.skadnetwork",
      "mlmmfzh3r3.skadnetwork",
      "578prtvx9j.skadnetwork",
      "4dzt52r2t5.skadnetwork",
      "gta9lk7p23.skadnetwork",
      "e5fvkxwrpn.skadnetwork",
      "8c4e2ghe7u.skadnetwork",
      "zq492l623r.skadnetwork",
      "3rd42ekr43.skadnetwork",
      "3qcr597p9d.skadnetwork"
    ],
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you.",
    "delay_app_measurement_init": true
  }
}

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

turtlefung commented 4 months ago

Got the same error. Just update the react-native-google-mobile-ads to the latest version and it will work. npm install react-native-google-mobile-ads@latest

thomasread99 commented 4 months ago

@turtlefung I updated to the latest version but I am still getting the error but am still getting errors when I build the app. Did you change anything else? Also, I am getting the following warning: Warning: Root-level "expo" object found. Ignoring extra key in Expo config: "react-native-google-mobile-ads" which I am wondering if that is to do with it. Do you have the same issue with your app.json file?

Randall71 commented 4 months ago

@thomasread99 the actual way to use this package was updated recently to use expo plugins correctly and the documentation was just refreshed, so follow it again to make it work correctly

github-actions[bot] commented 3 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.