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

[🐛] Android building FAILED with Execution failed for task ':app:compileDebugKotlin' with react-native 0.73.1

Open PotapovALeksey opened this issue 2 years ago • 9 comments

Issue

Describe your issue here

Hi, dear firebase community There is a problem with firebase after I updated react-native from version 0.72.6 to 0.73.1

Why am I sure that problem because of connecting firebase? Because I created the clear project using react-native and It was working. Once I set up firebase for it. The application is crashing

Here is a repository to reproduce it


Project Files

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • [ ] my application is an AndroidX application?
  • [ ] I am using android/gradle.settings jetifier=true for Android compatibility?
  • [ ] I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
  OS: macOS 14.1.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 122.02 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.12.0
    path: ~/.nvm/versions/node/v18.12.0/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 8.19.2
    path: ~/.nvm/versions/node/v18.12.0/bin/npm
  Watchman:
    version: 2023.09.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/apotapov/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.2 AI-212.5712.43.2112.8609683
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.0.0
    path: /Users/apotapov/.rvm/rubies/ruby-3.0.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false
  • Platform that you're experiencing the issue on:
    • [ ] iOS
    • [x] Android
    • [ ] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [ ] Both
  • react-native-firebase version you're using that has this issue:
    • 18.7.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


PotapovALeksey avatar Dec 27 '23 11:12 PotapovALeksey

Please could you paste the actual error message you are seeing in here? The repo link doesn't have the message and there is no example of it here. Put it in triple-backticks so it's formatted well like

Paste from the command line session where you tried your build and there was an error message, including the entire error message

mikehardy avatar Jan 06 '24 20:01 mikehardy

@mikehardy thanks for your response

Here is error stack trace

Starting a Gradle Daemon (subsequent builds will be faster)
> Task :gradle-plugin:pluginDescriptors
> Task :gradle-plugin:processResources
> Task :gradle-plugin:compileKotlin
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:classes
> Task :gradle-plugin:jar
> Task :gradle-plugin:inspectClassesForKotlinIC

> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 32.7.0
:react-native-firebase_app:play.play-services-auth using default value: 20.7.0
:react-native-firebase_app package.json found at /Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 18.7.3 (18,7,3 - 18007003)
:react-native-firebase_app:android.compileSdk using custom value: 34
:react-native-firebase_app:android.targetSdk using custom value: 34
:react-native-firebase_app:android.minSdk using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir /Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/node_modules/react-native/android

> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :app:generateDebugBuildConfig
> Task :react-native-firebase_app:preBuild UP-TO-DATE
> Task :react-native-firebase_app:preDebugBuild UP-TO-DATE
> Task :react-native-firebase_app:writeDebugAarMetadata
> Task :app:generateDebugResValues
> Task :app:processDebugGoogleServices
> Task :react-native-firebase_app:generateDebugResValues
> Task :react-native-firebase_app:generateDebugResources
> Task :app:checkDebugAarMetadata
> Task :react-native-firebase_app:packageDebugResources
> Task :app:mapDebugSourceSetPaths
> Task :app:generateDebugResources
> Task :app:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :react-native-firebase_app:extractDeepLinksDebug
> Task :react-native-firebase_app:compileDebugLibraryResources
> Task :react-native-firebase_app:generateDebugBuildConfig
> Task :app:mergeDebugResources
> Task :react-native-firebase_app:javaPreCompileDebug
> Task :app:javaPreCompileDebug
> Task :react-native-firebase_app:parseDebugLocalResources
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :react-native-firebase_app:mergeDebugShaders
> Task :react-native-firebase_app:compileDebugShaders NO-SOURCE
> Task :react-native-firebase_app:generateDebugAssets UP-TO-DATE
> Task :app:parseDebugLocalResources
> Task :react-native-firebase_app:packageDebugAssets

> Task :react-native-firebase_app:processDebugManifest
package="io.invertase.firebase" found in source AndroidManifest.xml: /Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/node_modules/@react-native-firebase/app/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored.
Recommendation: remove package="io.invertase.firebase" from the source AndroidManifest.xml: /Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/node_modules/@react-native-firebase/app/android/src/main/AndroidManifest.xml.

> Task :app:mergeDebugAssets
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:compressDebugAssets
> Task :react-native-firebase_app:generateDebugRFile
> Task :app:desugarDebugFileDependencies

> Task :react-native-firebase_app:compileDebugJavaWithJavac

> Task :react-native-firebase_app:processDebugJavaRes NO-SOURCE
> Task :react-native-firebase_app:bundleLibRuntimeToJarDebug
> Task :react-native-firebase_app:bundleLibCompileToJarDebug
> Task :app:mergeDebugJniLibFolders
> Task :react-native-firebase_app:mergeDebugJniLibFolders
> Task :react-native-firebase_app:mergeDebugNativeLibs NO-SOURCE
> Task :app:validateSigningDebug
> Task :react-native-firebase_app:copyDebugJniLibsProjectOnly
> Task :app:writeDebugAppMetadata
> Task :app:checkDebugDuplicateClasses
> Task :app:writeDebugSigningConfigVersions
> Task :app:processDebugManifestForPackage
> Task :app:processDebugResources
> Task :app:mergeDebugNativeLibs

> Task :app:compileDebugKotlin FAILED

> Task :app:mergeLibDexDebug
> Task :app:stripDebugDebugSymbols
> Task :app:mergeExtDexDebug

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
52 actionable tasks: 52 executed

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:27:58 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:29:50 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:30:49 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:39:9 Unresolved reference: BuildConfig

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 23s
info Run CLI with --verbose flag for more details.

AlekseyP18 avatar Jan 09 '24 12:01 AlekseyP18

Please could you paste the actual error message you are seeing in here? The repo link doesn't have the message and there is no example of it here. Put it in triple-backticks so it's formatted well like

Paste from the command line session where you tried your build and there was an error message, including the entire error message

I provided android building logs. Please help to solve this problem. Obviously the problem is with firebase

AlekseyP18 avatar Jan 23 '24 10:01 AlekseyP18

Obviously the problem is with firebase

Statements like this are so frequently wrong when troubleshooting software they should mentally throw up a red flag for you any time you have the urge to say them.

Very few things are obvious. This is not obviously a problem with firebase. And firebase is a cloud service, an underlying firebase-android-sdk, and react-native-firebase layers. Which is it, if it is "firebase"?


Note: Recompile with -Xlint:deprecation for details.
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:27:58 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:29:50 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:30:49 Unresolved reference: BuildConfig
e: file:///Users/apotapov/Desktop/DEVELOPMENT/react-native-firebase-error/android/app/src/main/java/com/awesomeproject/MainApplication.kt:39:9 Unresolved reference: BuildConfig

https://stackoverflow.com/questions/60942575/unresolved-reference-buildconfig-in-kotlin

So, you have an error message in your application code (note it is referenced in MainApplication.kt, not any react-native-firebase code) and the error message is for the lines using BuildConfig (https://github.com/PotapovALeksey/react-native-firebase-error/blob/cf318b5937f018b1e3caf18d60b2adefccabc186/android/app/src/main/java/com/awesomeproject/MainApplication.kt#L27-L30) that seems odd

Have you tried to enable the gradle buildconfig feature as suggested on the first stackoverflow that comes up for this error?

That'll solve it

mikehardy avatar Jan 30 '24 16:01 mikehardy

Hey, I have encountered the very same issue and it has nothing to do, as @mikehardy mentioned, with Firebase but rather the setup you do.

The issue on my end was that I changed app/build.gradle namespace and applicationId, but didn't change folder structure and package inside MainApplication.kt and MainActivity.kt . This is exactly the same case in reproduction repository.

Leaving this here in case someone happens to encounter the same thing. Nothing has to do with FIrebase.

akuul avatar Mar 01 '24 16:03 akuul

Hey, I have encountered the very same issue and it has nothing to do, as @mikehardy mentioned, with Firebase but rather the setup you do.

The issue on my end was that I changed app/build.gradle namespace and applicationId, but didn't change folder structure and package inside MainApplication.kt and MainActivity.kt . This is exactly the same case in reproduction repository.

Leaving this here in case someone happens to encounter the same thing. Nothing has to do with FIrebase.

This was exactly my problem. Not sure how you found it, but saved me more headaches. Thank you!!

analog1234 avatar Mar 23 '24 05:03 analog1234

Hey, I have encountered the very same issue and it has nothing to do, as @mikehardy mentioned, with Firebase but rather the setup you do.

The issue on my end was that I changed app/build.gradle namespace and applicationId, but didn't change folder structure and package inside MainApplication.kt and MainActivity.kt . This is exactly the same case in reproduction repository.

Leaving this here in case someone happens to encounter the same thing. Nothing has to do with FIrebase.

Thank you, checking and modifying the namespace and applicationId has worked for me: "com.app_name" according to the path: \android\app\src\main\java\com\app_name. Thank you very much.

nimeos avatar Apr 23 '24 16:04 nimeos

Hey, I have encountered the very same issue and it has nothing to do, as @mikehardy mentioned, with Firebase but rather the setup you do.

The issue on my end was that I changed app/build.gradle namespace and applicationId, but didn't change folder structure and package inside MainApplication.kt and MainActivity.kt . This is exactly the same case in reproduction repository.

Leaving this here in case someone happens to encounter the same thing. Nothing has to do with FIrebase.

I have no idea about your solution, please elaborate more by changing app/build.gralde namespace and applicationId. I am facing the exact same issue

4sskick avatar Aug 15 '24 09:08 4sskick

@akuul Thanks it works for me

Philip970 avatar Aug 17 '24 08:08 Philip970