任务:react-native-firebase:compileDebugJavaWithJavac失败

问题描述 投票:0回答:1

当我尝试在 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 {
            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

android firebase react-native react-native-firebase
1个回答
0
投票

/用户/用户名/文档/开发/TL/Mobile_CLI_staging/node_modules/@react-native-firebase/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java:1621:

在这条路上

/**
* linkWithCredential
*
* @param provider
* @param authToken
* @param authSecret
* @param promise
*/
@ReactMethod
private void linkWithCredential(
  String appName, String provider, String authToken, String authSecret,      final Promise promise) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);

AuthCredential credential = getCredentialForProvider(provider, authToken, authSecret);

if (credential == null) {
  rejectPromiseWithCodeAndMessage(
      promise,
      "invalid-credential",
      "The supplied auth credential is malformed, has expired or is not currently supported.");
} else {
  FirebaseUser user = firebaseAuth.getCurrentUser();
  Log.d(TAG, "link");

  if (user != null) {
    user.linkWithCredential(credential)
        .addOnCompleteListener(
            getExecutor(),
            task -> {
              if (task.isSuccessful()) {
                Log.d(TAG, "link:onComplete:success");
                promiseWithAuthResult(task.getResult(), promise);
              }
               // Comment all this**strong text** out 
                                  //                  else {
               //                    Exception exception =                    task.getException();
               //                    if (exception instanceof                    FirebaseAuthUserCollisionException collEx) {
               //                      AuthCredential updatedCredential = collEx.getUpdatedCredential();
               //                      Log.d(TAG, "link:onComplete:collisionFailure", collEx);
               //                      // If we have a credential in the error, we can return it, otherwise fall
               //                      // through
                                  //                      if (updatedCredential != null) {
               //                        Log.d(TAG, "link:onComplete:collisionFailure had credential", collEx);
               //                        promiseRejectLinkAuthException(promise, collEx, updatedCredential);
               //                        return;
               //                      }
               //                    }
               //                    Log.e(TAG, "link:onComplete:failure", exception);
               //                    promiseRejectAuthException(promise, exception);
               //                  }
            });
  } else {
    promiseNoUser(promise, true);
  }
}

}

© www.soinside.com 2019 - 2024. All rights reserved.