invertase/react-native-google-mobile-ads

[🐛] Android - Legacy Architecture - Build fails: Cannot access 'NativeAppModuleSpec'

Open

#857 opened on Jun 5, 2026

View on GitHub
 (4 comments) (0 reactions) (0 assignees)TypeScript (213 forks)github user discovery
help wanted

Repository metrics

Stars
 (1,010 stars)
PR merge metrics
 (PR metrics pending)

Description

What happened?

Android build on Legacy Architecture fails due to (I assume) New Architecture code. iOS builds fine.

The last working version on Android with Legacy Architecture (RN 0.81.6) is 16.0.1 as 16.0.2 introduces a breaking change.

Can be reproduced in a fresh project with just react-native-google-mobile-ads lib.

Build Errors:

e: file:///Users/x/Documents/Projects/mobileads/MyAwesomeApp/node_modules/react-native-google-mobile-ads/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt:41:28 Cannot access 'NativeAppModuleSpec' which is a supertype of 'ReactNativeAppModule'. Check your module classpath for missing or conflicting dependencies.
e: file:///Users/x/Documents/Projects/mobileads/MyAwesomeApp/node_modules/react-native-google-mobile-ads/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt:41:43 Return type mismatch: expected 'NativeModule?', actual 'ReactNativeAppModule'.
e: file:///Users/x/Documents/Projects/mobileads/MyAwesomeApp/node_modules/react-native-google-mobile-ads/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt:57:40 Cannot access 'NativeAppModuleSpec' which is a supertype of 'ReactNativeAppModule'. Check your module classpath for missing or conflicting dependencies.
e: file:///Users/x/Documents/Projects/mobileads/MyAwesomeApp/node_modules/react-native-google-mobile-ads/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt:59:32 Cannot access 'NativeAppModuleSpec' which is a supertype of 'ReactNativeAppModule'. Check your module classpath for missing or conflicting dependencies.

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

Platforms

Only on Android

React Native Info

System:
  OS: macOS 26.4
  CPU: (10) arm64 Apple M1 Max
  Memory: 106.28 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.13.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/x/.yarn/bin/yarn
  npm:
    version: 11.9.0
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/x/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34-ext9 | Android Automotive with Google APIs arm64-v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: 23.0.7344513-beta4
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13625888
  Xcode:
    version: 26.4/17E192
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/x/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.4
    wanted: 19.1.4
  react-native:
    installed: 0.81.6
    wanted: 0.81.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Are your using Typescript?

  • My project is using Typescript

package.json

{
  "name": "MyAwesomeApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native/new-app-screen": "0.81.6",
    "react": "19.1.4",
    "react-native": "0.81.6",
    "react-native-google-mobile-ads": "^16.3.3",
    "react-native-safe-area-context": "^5.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "20.0.0",
    "@react-native-community/cli-platform-android": "20.0.0",
    "@react-native-community/cli-platform-ios": "20.0.0",
    "@react-native/babel-preset": "0.81.6",
    "@react-native/eslint-config": "0.81.6",
    "@react-native/metro-config": "0.81.6",
    "@react-native/typescript-config": "0.81.6",
    "@types/jest": "^29.5.13",
    "@types/react": "^19.1.4",
    "@types/react-test-renderer": "^19.1.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.1.0",
    "typescript": "^5.8.3"
  },
  "engines": {
    "node": ">=20"
  }
}

app.json

{
  "name": "MyAwesomeApp",
  "displayName": "MyAwesomeApp",
  "react-native-google-mobile-ads": {
    "android_app_id": "com.myawesomeapp"
  }
}

ios/Podfile

android/build.gradle

android/app/build.gradle

android/settings.gradle

AndroidManifest.xml

Contributor guide