Firebase react-native无法访问

时间:2018-05-13 11:51:13

标签: android firebase react-native

我将firebase添加到我的本机应用程序中。我试图在android中编译它,我们遇到了问题。我团队的其他成员没有任何问题,他们中的一些人无法运行,他们正在收到消息。

 basePerformance.java:39: error: cannot access zze
    getOrCreateTrace(identifier).start();
                            ^
 class file for com.google.android.gms.internal.firebase-perf.zze not found

这听起来像是一个依赖性问题或类似的东西。我们现在正在奋斗一天,我们对此并不了解。有人可以帮忙吗?这是我们的gradle

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.ourApp"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 10
        versionName "0.1.6"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_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 fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-i18n')
    implementation project(':react-native-mail')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-fast-image')

    implementation(project(':react-native-firebase')) {
        transitive = false
    }

    // Firebase dependencies
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-messaging:15.0.2"
    implementation "com.google.firebase:firebase-analytics:15.0.2"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:1)

固定更改为Java 8

检查您正在使用的版本java -version

mac用户

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`