任务:react-native-firebase:compileDebugJavaWithJavac FAILED

时间:2018-09-29 20:14:03

标签: android firebase react-native react-native-firebase

当我尝试在Android设备上运行我的应用程序时,总是会遇到此错误。我逐步按照RNFirebase的说明将其添加到我的现有项目中,但是它不起作用。

> Task :app:processDebugGoogleServices 
Parsing json file: /Users/myname/Documents/myname/Programmierungen/Project/android/app/google-services.json

> Task :react-native-firebase:compileDebugJavaWithJavac FAILED
/Users/myname/Documents/myname/Programmierungen/Project/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java:50: error: cannot access zzf
    promise.resolve(getOrCreateTrace(identifier).getAttribute(attribute));
                                                ^
  class file for com.google.android.gms.internal.firebase-perf.zzf not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception

它在ios上可以正常工作,只是无法为android编译。

我的/app/build.gradle依赖项:(是的,我确实在最底部添加了apply插件)

    implementation project(':react-native-firebase')
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.3"    
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules

android / build.gradle-dependencies:

dependencies {
            classpath 'com.android.tools.build:gradle:3.1.4'
            classpath 'com.google.gms:google-services:4.0.1'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }

和所有项目:

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

其他有用信息:

    "dependencies": {
        "babel-preset-react-native": "^4.0.0",
        "react": "16.5.0",
        "react-native": "^0.57.1",
        "react-native-firebase": "^5.0.0"
      },   
    "devDependencies": {
       "@babel/core": "^7.1.2",
       "@babel/runtime": "^7.1.2",
       "babel-jest": "23.6.0",
       "jest": "23.6.0",
       "metro-react-native-babel-preset": "0.47.0",
       "react-test-renderer": "16.5.0"
     },
    "jest": {
       "preset": "react-native"
     }

我在使用Java 8的macos Mojave上进行编码。 感谢您的帮助! ':D

0 个答案:

没有答案