![](/img/trans.png)
[英]Crashlytics could not find the manifest with fabric.properties
[英]Crashlytics doesn't find my fabric.properties
我正在嘗試在我的應用程序中設置 Crashlytics,但我收到消息java.lang.IllegalArgumentException: Fabric 無法初始化,AndroidManifest.xml 中缺少 API 密鑰。 將以下標簽添加到您的 Application 元素,但我不想將我的密鑰放在 androidManifest 中,所以我必須創建 fabric.properties,對嗎? 到現在為止我的設置。
/app/fabric.properties 中的/app/fabric.properties
apiKey=XXXXXXXXXXXXXXXXXX
在 Application 類的OnCreate()
上初始化。
private void setupCrashlytics(){
CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
}
在gradle
設置依賴
apply plugin: 'com.android.application'
apply plugin: 'idea'
apply plugin: 'witness'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
dataBinding.enabled = true
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.douglas"
minSdkVersion 14
targetSdkVersion 27
versionCode 31
versionName "0.4.4"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.enableCrashlytics = false
}
debug {
debuggable true
minifyEnabled false
ext.enableCrashlytics = false
}
beta {
debuggable true
signingConfig signingConfigs.debug
ext.enableCrashlytics = true
}
}
sourceSets {
main {
jniLibs.srcDir file('jniLibs')
assets.srcDirs = ['assets']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:preference-v7:27.0.2'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:gridlayout-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
compile 'com.google.guava:guava:20.0'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.loopj.android:android-async-http:1.4.8'
compile 'com.google.code.gson:gson:2.8.0'
compile 'org.jsoup:jsoup:1.8.2'
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
}
我在Fabric gradle 插件 1.25.4 中遇到了同樣的問題,在將 Fabric gradle 版本更新到 1.31.0 后似乎已修復
classpath 'io.fabric.tools:gradle:1.31.0'
感謝這個stackoverflow答案: https : //stackoverflow.com/a/57206074/6671572
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.