我遵循面料的正式指示
https://www.fabric.io/kits/android/crashlytics/install
这是我的gradle.build文件
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
}
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 {
....
}
}
dependencies {
......
compile('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
但是当我尝试同步我的项目时,它说在以下位置找不到 io.fabric.tools:gradle:1.24.3 :
Error:Could not find io.fabric.tools:gradle:1.24.3.
Searched in the following locations:
file:/home/dev-00/soft/android-studio-3.0.0/android-studio/gradle/m2repository/io/fabric/tools/gradle/1.24.3/gradle-1.24.3.pom
file:/home/dev-00/soft/android-studio-3.0.0/android-studio/gradle/m2repository/io/fabric/tools/gradle/1.24.3/gradle-1.24.3.jar
https://jcenter.bintray.com/io/fabric/tools/gradle/1.24.3/gradle-1.24.3.pom
https://jcenter.bintray.com/io/fabric/tools/gradle/1.24.3/gradle-1.24.3.jar
... Required by:
project :
答案 0 :(得分:24)
在buildscript
区块中,您还需要添加结构仓库。
buildscript {
repositories {
//... jcenter(), google()...
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//......
}
}