Crashlytics找不到Google Services生成的资源文件。您可能需要执行:Process;Variant>GoogleServices任务

Crashlytics could not find the resource file generated by Google Services. You may need to execute the :processlt;Variantgt;GoogleServices Task(Crashlytics找不到Google Services生成的资源文件。您可能需要执行:Process;Variantgt;GoogleServices任务)
本文介绍了Crashlytics找不到Google Services生成的资源文件。您可能需要执行:Process;Variant>GoogleServices任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拿回了一个已经一年多没有更新的旧Android项目,并尝试使用当前的Google库进行设置。

但我想不出如何解决一个问题:

我的应用程序有4个变体:devDebug、devRelease、prodDebug和prodRelease。构建该项目只在*Debug One上工作。版本变体正在生成此错误:

Crashlytics找不到Google生成的资源文件 服务。您可能需要执行:process GoogleServices 任务。请检查您的Firebase项目配置 (https://firebase.google.com/docs/android/setup)。

应用程序已注册到Firebase,并且google-services.json文件已存在(我也重新下载以确保)。

Gradle根文件中的一些代码:

dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        //apt : https://bitbucket.org/hvisser/android-apt
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
    }

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://jitpack.io'
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

app Gradle文件的部分代码:

apply plugin: 'com.android.application'

android {

    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    signingConfigs {
        release_config {
            // config obfuscated
        }
    }
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "my.company.com"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 107
        versionName "1.19.0"

        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }
    
    dataBinding {
        enabled = true
    }
    
    // workaround for "duplicate files during packaging of APK" issue
    // see https://groups.google.com/d/msg/adt-dev/bl5Rc4Szpzg/wC8cylTWuIEJ
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'

        //Workaround to an issue due to google play-services 11.0.0 + rxJava
        exclude 'META-INF/rxjava.properties'
    }

    lintOptions {
        // Inspired by https://stackoverflow.com/a/51363161/3520621
        checkReleaseBuilds false
        abortOnError false
    }

    configurations.all {
        resolutionStrategy {
            force 'com.google.android.gms:play-services-basement:17.0.0'
        }
    }

    buildTypes {
        //Release -> Production version.
        release {
            debuggable false
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release_config

        }
        //Debug -> Development version.
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix " - debug"
            debuggable true
        }
    }

    flavorDimensions "public"

    productFlavors {
        dev {
            applicationIdSuffix ".dev"
            versionNameSuffix " - dev"
            dimension "public"
        }

        prod {
            dimension "public"
        }

    }
}

ext {
    supportLibVersion = '28.0.0'
}

dependencies {
    implementation group: 'com.google.firebase', name: 'firebase-analytics', version: '17.3.0'
    implementation 'com.google.firebase:firebase-crashlytics:17.3.0'

    // other libraries...
}

apply plugin: 'com.google.firebase.crashlytics'

configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains', module: 'annotations'
}

欢迎任何提示。

谢谢。

推荐答案

该错误实际上是在告诉您要做什么。

在终端运行中:

./gradlew :app:processProdReleaseGoogleServices

./gradlew :app:processDevReleaseGoogleServices

这篇关于Crashlytics找不到Google Services生成的资源文件。您可能需要执行:Process;Variant>GoogleServices任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)