Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更新Firebase Crashlytics SDK时出现问题_Android_Firebase_Gradle_Build.gradle_Crashlytics - Fatal编程技术网

Android 更新Firebase Crashlytics SDK时出现问题

Android 更新Firebase Crashlytics SDK时出现问题,android,firebase,gradle,build.gradle,crashlytics,Android,Firebase,Gradle,Build.gradle,Crashlytics,我正在按照迁移的步骤进行迁移,它给了我以下问题,我得到以下错误: 我有如下build.gradle项目: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() mavenLocal() google() }

我正在按照迁移的步骤进行迁移,它给了我以下问题,我得到以下错误:

我有如下build.gradle项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
    }
}

allprojects {
    repositories {
        //mavenLocal() must be listed at the top to facilitate testing
        mavenLocal()
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
buildscript {
    repositories {
        google()
    }

    dependencies {

        // Add the Google Services Gradle plugin (if it's not there already).
        classpath 'com.google.gms:google-services:4.3.3'
        // Add the Firebase Crashlytics Gradle plugin.
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
    }

    dependencies {

    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'
build.gradle:app如下所示:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
    }
}

allprojects {
    repositories {
        //mavenLocal() must be listed at the top to facilitate testing
        mavenLocal()
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
buildscript {
    repositories {
        google()
    }

    dependencies {

        // Add the Google Services Gradle plugin (if it's not there already).
        classpath 'com.google.gms:google-services:4.3.3'
        // Add the Firebase Crashlytics Gradle plugin.
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
    }

    dependencies {

    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'

我尝试添加
implementation'com.google.code.gson:gson:2.8.5'
,但我无法修复它,我搜索了互联网,找不到更多信息。有什么解决问题的建议吗?

经过多次测试,我已经解决了问题,在我的情况下,通过删除以下内容解决了问题:

// Add the Google Services Gradle plugin (if it's not there already).
classpath 'com.google.gms:google-services:4.3.3'
// Add the Firebase Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
在buildscript中的build.gradle:app dependencies中,将文件保留如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
    }
}

allprojects {
    repositories {
        //mavenLocal() must be listed at the top to facilitate testing
        mavenLocal()
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
buildscript {
    repositories {
        google()
    }

    dependencies {

        // Add the Google Services Gradle plugin (if it's not there already).
        classpath 'com.google.gms:google-services:4.3.3'
        // Add the Firebase Crashlytics Gradle plugin.
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
    }

    dependencies {

    }
}

apply plugin: 'com.android.application'

// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
}

android {
    compileSdkVersion 28
    //buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "------------"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 19
        versionName "1.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
    // Gradle automatically adds 'android.test.runner' as a dependency.
    useLibrary 'android.test.runner'

    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
    testImplementation 'junit:junit:4.12'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.0.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

    implementation 'com.google.code.gson:gson:2.8.5'
}

apply plugin: 'com.google.gms.google-services'

可以尝试添加mavenCentral()吗


到您的存储库

我认为您的实现“implementation'com.google.firebase:firebase-core:17.4.3”会引起这个问题。你能评论一下吗?我试过你说的@ShaluTD,但错误依然存在。感谢您尝试帮助我使用firebase版本“17.2.0”而不是17.4。3@ShaluTD我解决了这个问题,正如我的答案所示,谢谢你的帮助