[英]error: cannot find symbol class Crashlytics and Fabric
我正在按照 Fabric 官方文檔添加 crashlytic,我已經成功地在 gradle.build 文件中添加了所有內容,但是現在當我嘗試編寫Fabric.with(this, new Crashlytics());
它說:
Error:(163, 31) error: cannot find symbol class Crashlytics
Error:(163, 9) error: cannot find symbol variable Fabric
Error:Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
這是我的 gradle.build 文件
....
apply plugin: 'io.fabric'
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
....
classpath 'io.fabric.tools:gradle:1.24.3'
}
}
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.example.com"
....
}
}
dependencies {
......
compile('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
還嘗試過干凈的項目/重建等,但每次都遇到同樣的問題
固定! 這是 Android Studio 的錯。
解決方法:
文件-> 使緩存無效/重新啟動
之后,一切都完美無缺
嘗試添加
apply plugin: 'io.fabric'
並根據官方文檔https://docs.fabric.io/android/crashlytics/build-tools.html#gradle-advanced-setup自定義您的 gradle
apply plugin: 'io.fabric' 使用這個但在底部
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.