當我關閉DexGuard時,我的應用程序可以與Crashlytics完美結合。但是,當我添加以下配置來模糊我的代碼時,應用程序會在黑屏啓動時進行掃描。Android DexGuard:從混淆模型中排除Crashlytics
這裏是的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'dexguard'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':MyProject')
compile('commons-validator:commons-validator:1.4.0') {
exclude group: 'commons-logging', module: 'commons-logging'
}
compile project(':android-maps-extensions')
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
}
android {
publishNonDefault true
compileSdkVersion 23
buildToolsVersion "23"
compileOptions {
encoding "windows-1254"
}
defaultConfig {
applicationId "com.x.y"
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled true
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
dexOptions{
incremental true
javaMaxHeapSize "4g"
jumboMode true
}
android.enforceUniquePackageName = false
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultDexGuardFile('dexguard-release.pro'),'dexguard-project.txt'
}
}
}
基地的build.gradle的相關部分文件:
buildscript {
repositories {
flatDir dirs: System.getenv('DEXGUARD_LIB')
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath ':dexguard'
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
dexguard-project.txt文件的
相關部分:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-multidex
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
logcat的控制檯輸出:
Could not find method com.crashlytics.android.Crashlytics.getInstance, referenced from method com.x.y.application.MyApplication.ʻ
Could not find method com.crashlytics.android.Crashlytics.getInstance, referenced from method com.x.y.application.MyApplication.ˏ
Could not find method com.crashlytics.android.Crashlytics.getInstance, referenced from method com.x.y.application.MyApplication.ᐝ
Starting window AppWindowToken{4518e2c0 token=Token{43255cd8 ActivityRecord{42d2a290 u0 com.x.y.tst/com.x.y.activity.start.FirstActivity t369}}} timed out
什麼,我實際上Crashlytics.getInstance做:
Crashlytics.getInstance().core.setString("ENVIRONMENT", "TEST");
我看到在構建日誌中沒有警告或錯誤。 任何人有一個想法是什麼原因造成的問題?
在此先感謝!
謝謝!這解決了我的問題。 – bracken
我試過這個,但沒有運氣。現在我刪除了不必要的GooglePlayServices組件,並且引用數量減少到65k以下。無論如何感謝您的答覆。 –