Upon upgrading to v4.1.0 and v15 Android Libraries, I run into the following error while running ./gradlew installDebug
:
.../node_modules/react-native-firebase/android/src/main/
java/io/invertase/firebase/perf/RNFirebasePerformance.java:39:
error: cannot access zze
getOrCreateTrace(identifier).start();
^
class file for com.google.android.gms.internal.firebase-perf.zze not found
EDIT: Downgrading to JDK8 allows the app to build, which is the current workaround. JDK10 is not supported, but should probably be supported in the near future.
I have upgraded my android/build.gradle
to use com.android.tools.build:gradle:3.1.2
and com.google.gms:google-services:3.2.1
. Furthermore, I have tried building from a clean react-native-firebase-starter
and that too failed with the same error.
Below is my android/app/build.gradle
:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.company.appname"
minSdkVersion 16
targetSdkVersion 27
versionCode 101
versionName "0.1.1"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
release {
if (project.hasProperty('APP_RELEASE_STORE_FILE')) {
storeFile file(APP_RELEASE_STORE_FILE)
storePassword APP_RELEASE_STORE_PASSWORD
keyAlias APP_RELEASE_KEY_ALIAS
keyPassword APP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-code-push')
implementation (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support"
implementation ("com.google.android.gms:play-services-vision:15.0.2")
}
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation project(':react-native-vector-icons')
// Firebase dependencies
implementation "com.google.android.gms:play-services-base:15.0.0"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-database:15.0.0"
implementation "com.google.firebase:firebase-functions:15.0.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-storage:15.0.2"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.0"
implementation "com.android.support:multidex:1.0.1"
implementation "com.android.support:exifinterface:27.1.0"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all implementation dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
MainApplication.java
:
package com.company.appname;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.microsoft.codepush.react.CodePush;
import org.reactnative.camera.RNCameraPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
import io.invertase.firebase.functions.RNFirebaseFunctionsPackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(null, getApplicationContext(), BuildConfig.DEBUG),
new RNCameraPackage(),
new RNFirebasePackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseDatabasePackage(),
new RNFirebaseFunctionsPackage(),
new RNFirebaseMessagingPackage(),
new RNFirebaseStoragePackage(),
new RNFirebaseNotificationsPackage(),
new VectorIconsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
And also, a snippet of ./gradlew app:dependencies
:
+--- project :react-native-firebase
+--- com.google.android.gms:play-services-base:15.0.0 -> 15.0.1 (*)
+--- com.google.firebase:firebase-core:15.0.2
| +--- com.google.firebase:firebase-analytics:[15.0.2,16.0.0) -> 15.0.2
| | +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | +--- com.google.android.gms:play-services-measurement-base:[15.0.2] -> 15.0.2
| | +--- com.google.android.gms:play-services-stats:[15.0.1,16.0.0) -> 15.0.1
| | | \--- com.google.android.gms:play-services-basement:[15.0.1] -> 15.0.1 (*)
| | +--- com.google.firebase:firebase-analytics-impl:[15.0.2] -> 15.0.2
| | | +--- com.google.android.gms:play-services-ads-identifier:[15.0.1,16.0.0) -> 15.0.1
| | | | \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.android.gms:play-services-measurement-base:[15.0.2] -> 15.0.2
| | | +--- com.google.android.gms:play-services-stats:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1
| | | | +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | | \--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | \--- com.google.firebase:firebase-iid:[15.1.0,16.0.0) -> 15.1.0
| | | +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.android.gms:play-services-stats:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | +--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | \--- com.google.firebase:firebase-iid-interop:[15.0.0,16.0.0) -> 15.0.0
| | | +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1 (*)
| | | \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | \--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-measurement-connector-impl:[15.0.0,16.0.0) -> 15.0.0
| +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-measurement-base:[15.0.2] -> 15.0.2
| +--- com.google.firebase:firebase-analytics:[15.0.2] -> 15.0.2 (*)
| +--- com.google.firebase:firebase-analytics-impl:[15.0.2] -> 15.0.2 (*)
| +--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-measurement-connector:[15.0.0,16.0.0) -> 15.0.0
| \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
+--- com.google.firebase:firebase-auth:15.1.0
| +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-flags:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-analytics:[15.0.1,16.0.0) -> 15.0.2 (*)
| +--- com.google.firebase:firebase-auth-interop:[15.0.2,16.0.0) -> 15.0.2
| | +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1 (*)
| | +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| | +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| | \--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
+--- com.google.firebase:firebase-database:15.0.0
| +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-database-collection:[15.0.0,16.0.0) -> 15.0.1
| | \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-database-connection:[15.0.0] -> 15.0.0
| +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-analytics:[15.0.0,16.0.0) -> 15.0.2 (*)
| \--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.1 (*)
+--- com.google.firebase:firebase-functions:15.0.0
| +--- com.squareup.okhttp:okhttp:2.7.2
| | \--- com.squareup.okio:okio:1.6.0 -> 1.13.0
| +--- com.google.firebase:firebase-core:[15.0.0,16.0.0) -> 15.0.2 (*)
| +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-base:[15.0.0,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-iid:[15.0.0,16.0.0) -> 15.1.0 (*)
| +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.1 (*)
+--- com.google.firebase:firebase-storage:15.0.2
| +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-analytics:[15.0.1,16.0.0) -> 15.0.2 (*)
| +--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.firebase:firebase-storage-common:[15.0.2] -> 15.0.2
| \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
+--- com.google.firebase:firebase-messaging:15.0.2
| +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-common:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.firebase:firebase-core:[15.0.2,16.0.0) -> 15.0.2 (*)
| +--- com.google.firebase:firebase-iid:[15.1.0] -> 15.1.0 (*)
| \--- com.google.firebase:firebase-measurement-connector:[15.0.0,16.0.0) -> 15.0.0 (*)
Android
Application Target Platform: macOS High Sierra
Development Operating System: Terminal with Android SDK 27
Build Tools: 27.0.3
React Native version: 0.55.3
RNFirebase Version: 4.1.0
Firebase Module: Core
I have the same issue
Same with 12.0.1 and RN 0.55.4
Tried with build tools 26 too.
app/build.gradle:
compileSdkVersion 27
buildToolsVersion '27.0.3'
.....
googlePlayServicesVersion = "12.0.1"
......
implementation "com.google.firebase:firebase-core:${googlePlayServicesVersion}"
implementation "com.google.firebase:firebase-messaging:${googlePlayServicesVersion}"
build.gradle:
/**
+ Project-wide Gradle configuration properties
*/
ext {
compileSdkVersion = 27
targetSdkVersion = 27
buildToolsVersion = "27.0.3"
supportLibVersion = "27.1.1"
googlePlayServicesVersion = "12.0.1"
androidMapsUtilsVersion = "0.5+"
}
@barbsicle I am also facing same error. Did you find any solution?
No, unfortunately. My only workaround so far is to go into the errant file at RNFirebasePerformance.java
and comment out all methods. This is naturally not good due to the fact that you have to modify node_modules
, but it allows the build to pass and I do not require firebase-perf in my app so I have no problems with it.
Am also speaking to @chrisbianca on Discord, hopefully we can find a fix soon.
Hey!
Maybe the issue is with the newest node and npm!
On node 10 and npm 6 it isn't working for me.
But on node 8 and npm 5.6 it works great!
@DLevai94 Thanks for the suggestion. I tried downgrading to node 8 and npm 5, rm -rf node_modules && yarn
, didn't work unfortunately.
EDIT: In line with your idea, I downgraded to Java 8 (from 10) and it builds! I guess it's not advisable to use Java 10 with React Native.
I have same issue. Is downgrading java to 8 the only way to solve this problem?
RNF4.0.0 worked ok with jdk10, and 4.1.0 works only with java8 (or below maybe) ? Doesn't sounds right.
@fl-nishida I agree, RN <4.1.0 was working just fine with jdk10. I'm sure the team will fix compatibility in due time, but downgrading to jdk8 is the current workaround.
That said, I'll rename and reopen the issue to point towards working towards a fix for jdk10.
@barbsicle Thanks for reopening the issue again. I will workaround with java8 for now with worries of java8 causing other version trouble.
Any fix for this? My APP was working just fine until I upgraded :-|
+1
4.1.0 broke builds for Java10. As a temporary workaround on MacOS, I downloaded latest Java8 SDK and ran:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
before compiling.
The app is broken for me if I use the react-native run-android
command but if I run it from Android Studio it works with no problems, so weird.
โข react-native: 0.55.3
โข react: 16.3.2
โข react-native-firebase: 4.1.0
โข Java: 10.0.1
Thanks @rikur, your answer is the only thing that worked for me after hours of trying to fix this issue.
If someone can create a reproducible repo that I can clone then I can debug locally on Java 10 and see if I can get a fix in place as a patch version.
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter @Salakar I'm sure you could use any existing project or examples. Make sure to require react-native-firebase 4.1.0+, follow the instructions at https://github.com/invertase/react-native-firebase/releases/tag/v4.1.0 and try to react-native run-android
with Java 9 or Java 10.
Sorry if that's of no help.
@rikur on JDK 9~ myself and all still working - couldn't reproduce hence why I was wondering if anyone could drop a repo for me to clone. ๐ธ
I will, however, give Java 10 a go at the weekend and report back.
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter @Salakar Any feedback yet?
On Ubuntu 18.04 with open JDK 8 I was getting this error, when I installed Oracle's JDK 8 instead the error went away. Hopefully this helps to repro and resolve the issue.
I've just added https://github.com/invertase/react-native-firebase/commit/0426dd5c8c096dc5ad69d99011073cb6a27a27ef to address this - could someone with JDK 10 issues try it out locally by editing the same file in node_modules and let me know how they get on.
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter I tried the fix @Salakar and got this:
A problem occurred configuring project ':react-native-firebase'.
java.lang.NullPointerException (no error message)
I also got the NullPointerException after applying the commit linked by @Salakar . Here's the relevant part of the stacktrace:
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:782)
at com.google.common.base.Splitter.split(Splitter.java:376)
at com.android.utils.PathUtils.getClassPathItems(PathUtils.java:84)
at com.android.build.gradle.internal.transforms.FixStackFramesTransform.<init>(FixStackFramesTransform.java:151)
at com.android.build.gradle.internal.TaskManager.maybeCreateDesugarTask(TaskManager.java:2425)
at com.android.build.gradle.internal.TaskManager.createPostCompilationTasks(TaskManager.java:2248)
at com.android.build.gradle.internal.TaskManager.createAndroidTestVariantTasks(TaskManager.java:1942)
at com.android.build.gradle.internal.VariantManager.createTasksForVariantData(VariantManager.java:521)
at com.android.build.gradle.internal.VariantManager.lambda$createAndroidTasks$1(VariantManager.java:352)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:348)
at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$6(BasePlugin.java:751)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:746)
at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:652)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:648)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy26.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
I also get the NullPointerException
with version 5.1.0
and OpenJDK 10.
Running on JDK 11 I was getting the NullPointerException
as well.
If you add the following to android/gradle.properties
I was able to build:
android.enableD8.desugaring=true
I found the above workaround at https://stackoverflow.com/questions/52182435/android-gradle-error-gradle-build-nullpointerexception-when-building-java
@ianoshorty That's an interesting hint! My current workaround is to have two JDKs installed and use JDK8 when working on RN apps. I've put the following in my /Users/<name>/.gradle/gradle.properties
org.gradle.java.home=/...path-to-JDK8
One might need to clear previously started gradle daemon processes using:
./gradlew --stop
Most helpful comment
+1
4.1.0 broke builds for Java10. As a temporary workaround on MacOS, I downloaded latest Java8 SDK and ran:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
before compiling.