invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

cannot find symbol variable VERSION_NAME #3716

Closed ardyfeb closed 4 years ago

ardyfeb commented 4 years ago

Issue

Describe your issue here

node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java:38: error: cannot find symbol
        BuildConfig.VERSION_NAME
                   ^
  symbol:   variable VERSION_NAME
  location: class BuildConfig

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "pdh", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.2", "@react-native-firebase/app": "^7.1.0", "@react-native-firebase/crashlytics": "^7.1.0", "@react-native-firebase/database": "^7.1.0", "@react-navigation/native": "^5.5.0", "deox": "^3.2.1", "immer": "^6.0.9", "react": "16.11.0", "react-native": "0.62.2", "react-native-gesture-handler": "^1.6.1", "react-native-paper": "^3.10.1", "react-native-reanimated": "^1.9.0", "react-native-safe-area-context": "^3.0.0", "react-native-screens": "^2.8.0", "react-native-vector-icons": "^6.6.0", "react-redux": "^7.2.0", "redux": "^4.0.5" }, "devDependencies": { "@babel/core": "^7.10.1", "@babel/runtime": "^7.10.1", "@react-native-community/eslint-config": "^1.1.0", "babel-jest": "^26.0.1", "eslint": "^7.1.0", "jest": "^26.0.1", "metro-react-native-babel-preset": "^0.59.0", "react-test-renderer": "16.11.0" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

Android

Click To Expand

#### Have you converted to AndroidX? - [ x] my application is an AndroidX application? - [ x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility?

mikehardy commented 4 years ago

Fixed in #3711, dupe of #3254

Available in public release - update packages, should work - please search issues prior to posting, thanks!

ardyfeb commented 4 years ago

@mikehardy Upgrading packages not fix issue, #3254 is different problem

I tweaked this file to make this package running https://github.com/invertase/react-native-firebase/blob/master/packages/app/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java

public class ReactNativeFirebaseAppRegistrar implements ComponentRegistrar {
  @Override
  public List<Component<?>> getComponents() {
    return Collections.singletonList(
      LibraryVersionComponent.create(
        "react-native-firebase",
-        BuildConfig.VERSION_NAME
+       "7.1.4" // package.json version
      )
    );
  }
}
mikehardy commented 4 years ago

Oh my - that is a different issue. In v5 I had to put that in manually (as you have done). This should be coming from the package.json and not from the app's version though, so I'm not sure it was actually correct.

Either way, see if turning on 'buildConfig' like here works: https://developer.android.com/studio/releases/gradle-plugin#buildFeatures

@Salakar this is another Android Studio 4.0 issue, appears separate, and I'm not sure it was actually correct prior s it's not the library version it would have been the app version (probably a lot of 1.0's...)