sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Android failing to build with Google-Services plugin not configured properly.

Open abisalde opened this issue 2 months ago • 9 comments

What React Native libraries do you use?

RN New Architecture

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

7.4.0

How does your development environment look like?

⬇  Place the `npx react-native@latest info` output here. ⬇

Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.27812.49.2514.14217341
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.4
    wanted: 0.81.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Sentry.init()

Sentry.init({
  dsn: 'https://[email protected]/...'
  // other options
});

Steps to Reproduce

  • Start up a React-Native project with New Architecture
  • Start the metro dev server with npx react-native start in a terminal
  • Build Android using npx react-native run-android
  • Don't add google-services.json to Android

Expected Result

Android build should not fail

Actual Result

apps/node_modules/@sentry/react-native/sentry.gradle' line: 33

* What went wrong:
A problem occurred evaluating root project 'aurora'.
> Failed to apply plugin 'com.facebook.react.rootproject'.
   > A problem occurred configuring project ':app'.
      > Could not create task ':app:uploadCrashlyticsSymbolFileBaseappRelease'.
         > Google-Services plugin not configured properly.

abisalde avatar Oct 21 '25 17:10 abisalde

RN-369

linear[bot] avatar Oct 21 '25 17:10 linear[bot]

Thank you for your report @abisalde 🙇

Based on the information shared, the error you are encountering:

      > Could not create task ':app:uploadCrashlyticsSymbolFileBaseappRelease'.
         > Google-Services plugin not configured properly.

is related to the Crashlytics (Firebase) integration, not Sentry itself (related Crashlytics issue). This error typically occurs when the google-services.json file is missing from your Android project, but it is required by the Crashlytics Gradle plugin.

Could you test with Crashlytics disabled/removed?

Are you setting up Sentry on a new project or you noticed the issue after bumping to the latest (7.4.0) version?

antonis avatar Oct 22 '25 10:10 antonis

Thank you for your report @abisalde 🙇

Based on the information shared, the error you are encountering:

      > Could not create task ':app:uploadCrashlyticsSymbolFileBaseappRelease'.
         > Google-Services plugin not configured properly.

is related to the Crashlytics (Firebase) integration, not Sentry itself (related Crashlytics issue). This error typically occurs when the google-services.json file is missing from your Android project, but it is required by the Crashlytics Gradle plugin.

Could you test with Crashlytics disabled/removed?

Are you setting up Sentry on a new project or you noticed the issue after bumping to the latest (7.4.0) version?

Hi @antonis, this error occurs when I bumped Sentry from 7.3.0 to 7.4.0. Working with Sentry 7.3.0

abisalde avatar Oct 22 '25 10:10 abisalde

Thank you for iterating so quickly @abisalde 🙏

this error occurs when I bumped Sentry from 7.3.0 to 7.4.0. Working with Sentry 7.3.0

Could you share how your Crashlytics and Sentry configuration to help us reproduce the issue?

antonis avatar Oct 22 '25 10:10 antonis

Could you share how your Crashlytics and Sentry configuration to help us reproduce the issue?

android/build.gradle
buildscript {
    ext {
        buildToolsVersion = "36.0.0"
        minSdkVersion = 26
        compileSdkVersion = 36
        targetSdkVersion = 36
        ndkVersion = "27.1.12297006"
        kotlinVersion = "2.1.20"
        androidXBrowser = "1.5.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
        classpath ("com.google.gms:google-services:4.4.4")
        classpath ("com.google.firebase:perf-plugin:2.0.1")
        classpath ("com.google.firebase:firebase-crashlytics-gradle:3.0.5")
    }
}

apply plugin: "expo-root-project"
apply plugin: "com.facebook.react.rootproject"
// package.json

    "@react-native-firebase/analytics": "~23.0.1",
    "@react-native-firebase/app": "~23.0.1",
    "@react-native-firebase/crashlytics": "~23.0.1",
    "@react-native-firebase/messaging": "~23.0.1",
    "@react-native-firebase/perf": "~23.0.1",
// index.js

import  "@react-native-firebase/crashlytics"

Sentry.init({
dsn: '',
// all other config
})

abisalde avatar Oct 22 '25 10:10 abisalde

Thank you. We will investigate this and iterate back.

antonis avatar Oct 22 '25 10:10 antonis

@abisalde would you mind also sharing android/app/build.gradle if available?

romtsn avatar Oct 22 '25 13:10 romtsn

@abisalde would you mind also sharing android/app/build.gradle if available?

This is how far I can go

// android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
def isReleaseBuild = getGradle().getStartParameter().getTaskRequests().toString().contains("Release")
if (isReleaseBuild) {
apply from: "../../node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle"
}
apply plugin: "com.google.firebase.firebase-perf"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
def enableProguardInReleaseBuilds = false

def jscFlavor = 'io.github.react-native-community:jsc-android-intl:2026004.+'

apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle")


react {
  autolinkLibrariesWithApp()
}

abisalde avatar Oct 22 '25 13:10 abisalde

Thank you for sharing 🙇 We will investigate this and iterate back.

antonis avatar Oct 31 '25 09:10 antonis