Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.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
Java &引用;错误:包com.google.firebase.iid不存在;更新Firebase Crashlytics依赖项后_Java_Android_Firebase_Crashlytics - Fatal编程技术网

Java &引用;错误:包com.google.firebase.iid不存在;更新Firebase Crashlytics依赖项后

Java &引用;错误:包com.google.firebase.iid不存在;更新Firebase Crashlytics依赖项后,java,android,firebase,crashlytics,Java,Android,Firebase,Crashlytics,我已从更新了我的Firebase Crashlytics implementation 'com.google.firebase:firebase-crashlytics:17.1.1' 到 现在我得到了这个错误: error: package com.google.firebase.iid does not exist 当我尝试导入此文件时: import com.google.firebase.iid.FirebaseInstanceId; import com.google.fireb

我已从更新了我的Firebase Crashlytics

implementation 'com.google.firebase:firebase-crashlytics:17.1.1'

现在我得到了这个错误:

error: package com.google.firebase.iid does not exist
当我尝试导入此文件时:

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
这是我的项目级build.gradle文件:

buildscript {
    ext {
        kotlin_version = '1.3.72'
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:perf-plugin:1.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "..."
        minSdkVersion 16
        targetSdkVersion 30
        versionCode ...
        versionName "..."
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            //shrinkResources true NOT SUPPORTED FOR DYNAMIC MODULES
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexEnabled true
        }
        debug {
            multiDexEnabled true
        }
    }

    dynamicFeatures = [":premium", ':tutorial']
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    api 'androidx.appcompat:appcompat:1.2.0'
    api 'com.google.android.material:material:1.2.1'
    api 'androidx.constraintlayout:constraintlayout:2.0.4'
    api 'com.google.android.play:core:1.8.3'
    api 'com.google.firebase:firebase-analytics:18.0.0'
    api 'com.google.firebase:firebase-perf:19.0.10'
    api 'com.google.firebase:firebase-invites:17.0.0'
    api 'com.google.firebase:firebase-firestore:22.0.0'
    api 'androidx.legacy:legacy-support-v4:1.0.0'
    api 'com.google.firebase:firebase-config:20.0.1'
    implementation 'com.google.firebase:firebase-appindexing:19.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    api 'androidx.navigation:navigation-fragment:2.3.1'
    api 'androidx.cardview:cardview:1.0.0'
    api 'androidx.recyclerview:recyclerview:1.1.0'
    api 'androidx.preference:preference:1.1.1'
    implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    api 'com.google.firebase:firebase-auth:20.0.1'
    api 'com.google.zxing:core:3.3.3'
    api 'com.android.billingclient:billing:3.0.1'
    //api 'com.facebook.android:facebook-android-sdk:5.15.3'
    implementation 'com.google.android.gms:play-services-ads-lite:19.5.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.datatransport:transport-runtime:2.2.5'
}
这是我的应用程序级别build.gradle文件:

buildscript {
    ext {
        kotlin_version = '1.3.72'
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:perf-plugin:1.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "..."
        minSdkVersion 16
        targetSdkVersion 30
        versionCode ...
        versionName "..."
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            //shrinkResources true NOT SUPPORTED FOR DYNAMIC MODULES
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexEnabled true
        }
        debug {
            multiDexEnabled true
        }
    }

    dynamicFeatures = [":premium", ':tutorial']
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    api 'androidx.appcompat:appcompat:1.2.0'
    api 'com.google.android.material:material:1.2.1'
    api 'androidx.constraintlayout:constraintlayout:2.0.4'
    api 'com.google.android.play:core:1.8.3'
    api 'com.google.firebase:firebase-analytics:18.0.0'
    api 'com.google.firebase:firebase-perf:19.0.10'
    api 'com.google.firebase:firebase-invites:17.0.0'
    api 'com.google.firebase:firebase-firestore:22.0.0'
    api 'androidx.legacy:legacy-support-v4:1.0.0'
    api 'com.google.firebase:firebase-config:20.0.1'
    implementation 'com.google.firebase:firebase-appindexing:19.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    api 'androidx.navigation:navigation-fragment:2.3.1'
    api 'androidx.cardview:cardview:1.0.0'
    api 'androidx.recyclerview:recyclerview:1.1.0'
    api 'androidx.preference:preference:1.1.1'
    implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    api 'com.google.firebase:firebase-auth:20.0.1'
    api 'com.google.zxing:core:3.3.3'
    api 'com.android.billingclient:billing:3.0.1'
    //api 'com.facebook.android:facebook-android-sdk:5.15.3'
    implementation 'com.google.android.gms:play-services-ads-lite:19.5.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.datatransport:transport-runtime:2.2.5'
}
firebase crashlytics依赖项版本17.1.1及以下版本不会发生此错误

我已经试过:

  • 改建工程
  • 清洁工程
  • 使缓存无效并重新启动

如果您有存储库,请尝试添加mavenCentral()

或者试试这个


或者这

这个问题的解决方案是
FirebaseInstanceId
被折旧。这意味着它不再包含在库中


您可以在此处找到更多信息:

是。我已经加上了。