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

Cannot get property 'googleMobileAdsJson' on extra properties extension as it does not exist #255

Closed ShumGG closed 2 years ago

ShumGG commented 2 years ago

Using expo managed workflow, sdk 46, installed the package using: yarn add react-native-google-mobile-ads.

building with eas, command used: eas build --profile development -p android

error when building:

[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/react-native-google-mobile-ads/android/build.gradle' line: 75
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':react-native-google-mobile-ads'.
[stderr] > Cannot get property 'googleMobileAdsJson' on extra properties extension as it does not exist
[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] A problem occurred configuring project ':react-native-google-mobile-ads'.
[stderr] > compileSdkVersion is not specified. Please add it to build.gradle
[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 2m 33s

app.json:

{
  "expo": {
    "name": "xxx",
    "scheme": "xxxx",
    "slug": "xxxx",
    "version": "1.0.8",
    "owner": "xxx",
    "orientation": "portrait",
    "privacy": "public",
    "platforms": [
      "ios",
      "android"
    ],
    "userInterfaceStyle": "automatic",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/220601_logo_ending_animation_1080X1920_App.png",
      "resizeMode": "contain",
      "backgroundColor": "#28262F"
    },
    "updates": {
      "enabled": true,
      "checkAutomatically": "ON_LOAD",
      "fallbackToCacheTimeout": 3
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "buildNumber": "3",
      "infoPlist": {
        "UIBackgroundModes": [
          "audio"
        ]
      },
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "androidStatusBar": {
      "translucent": false,
      "backgroundColor": "#28262F"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/android-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "icon": "./assets/xxx.png",
      "package": "media.dl",
      "googleServicesFile": "./google-services.json",
      "useNextNotificationsApi": true,
      "versionCode": 10008,
      "permissions": [
        "android.permission.POST_NOTIFICATIONS",
        "RECEIVE_BOOT_COMPLETED",
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.INTERNET",
        "android.permission.RECORD_AUDIO"
      ],
    "web": {
      "config": {
        "firebase": {
          "apiKey": "xxx",
          "measurementId": "xxx"
        }
      },
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "expo-splash-screen", 
      "expo-file-system",
      "@notifee/react-native",
      [
        "expo-notifications",
        {
          "icon": "./assets/xxx_96x96.png",
          "color": "#ffffff"
        }
      ],
      [
        "expo-image-picker",
        {
          "photosPermission": "The app accesses your photos to let you choose."
        }
      ],
      "expo-build-properties",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ]
    ],
    "description": "",
    "extra": {
      "eas": {
        "projectId": "xxxx"
      }
    }
  }
}
mikehardy commented 2 years ago

This happens if you have not performed the configuration steps as documented https://docs.page/invertase/react-native-google-mobile-ads#setting-up-google-admob