我已按照官方文档整合firebase crashlytis。 https://firebase.google.com/docs/crashlytics/get-started
它适用于调试版本&我也在控制台崩溃了,但是我在生成签名APK时遇到了错误。
Warning:com.twitter.sdk.android.core.internal.scribe.ScribeFilesSender$ConfigRequestInterceptor: can't find referenced method 'java.lang.String getDeviceUUID()' in program class io.fabric.sdk.android.services.common.IdManager
Information:See complete output in console
Warning:there were 1 unresolved references to program class members.
Information:3 warnings
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForLivedemoRelease'.
> Job failed, see logs for details
Information:1 error
Information:BUILD FAILED in 10s
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
app level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
----
minSdkVersion 16
targetSdkVersion 25
versionCode 5885
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
buildConfigField 'boolean', 'DIALER_WITH_RECENT', 'false'
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "prod"
productFlavors {
prod {
dimension "prod"
.....
}
livedemo {
dimension "prod"
.....
}
stage {
dimension "prod"
.....
}
stage2 {
dimension "prod"
....
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
/*androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})*/
//bluetooth
//compile 'com.estimote:sdk:0.11.1@aar'//Beacon-code
/*androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}*/
//compile 'com.android.support.constraint:constraint-layout:1.0.2'
/*compile 'com.google.firebase:firebase-messaging:10.0.1'*/
//facebook login
//twitter login
implementation('com.twitter.sdk.android:twitter-core:1.6.6@aar') {
transitive = true
}
implementation('com.twitter.sdk.android:twitter:1.13.1@aar') {
transitive = true
}
implementation project(':libraryHashTag')
implementation files('libs/SQLiteStudioRemote.jar')
implementation project(':SwipeMenuLibCustom')
implementation files('libs/jtar-1.1.jar')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.google.android.gms:play-services-safetynet:11.8.0'
implementation 'com.github.clans:fab:1.6.4'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.google.android.gms:play-services-analytics:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-base:11.8.0'
implementation 'com.github.kenglxn.QRGen:android:2.4.0'
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'com.facebook.android:facebook-android-sdk:4.28.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.splitwise:tokenautocomplete:2.0.8'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.android.gms:play-services-vision:11.8.0'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
/*For Crashlytics*/
releaseImplementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
compile 'com.google.firebase:firebase-core:11.8.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
Proguard规则文件
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn javax.annotation.**
-dontwarn com.squareup.okhttp3.**
-keep class com.squareup.okhttp3.** { *; }
-keep interface com.squareup.okhttp3.* { *; }
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.GuardedBy
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-dontwarn okio.**
-dontwarn org.apache.lang.**
-dontwarn org.joda.time.**
-dontwarn org.w3c.dom.**
-dontwarn com.viewpagerindicator.**
-keep class android.support.v4.** { *; }
-dontnote android.support.v4.**
-dontwarn retrofit2.Platform$Java8
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v7.app.** { *; }
-keep interface android.support.v7.app.** { *; }
-keep class android.support.v7.widget.SearchView { *; }
-keep class org.ocpsoft.prettytime.**
-keep class com.estimote.sdk.* { *; }
-keep interface com.estimote.sdk.* { *; }
-dontwarn com.estimote.sdk.**
-dontwarn com.beloo.widget.chipslayoutmanager.Orientation
-keep class com.beloo.widget.chipslayoutmanager.* { *; }
-keep class com.beloo.widget.chipslayoutmanager.** { *; }
-keep class com.beloo.widget.chipslayoutmanager.*$* { *; }
-keep class RestrictTo.*
-keep class RestrictTo.**
-keep class RestrictTo.*$*
-keep class org.ocpsoft.prettytime.i18n.**
-keepclassmembers class android.support.design.internal.BottomNavigationMenuView {
boolean mShiftingMode;
}
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
#-renamesourcefileattribute SourceFile
#-keepattributes SourceFile,LineNumberTable
#-printmapping mapping.txt
#-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
答案 0 :(得分:2)
Mike来自Fabric。您正在使用Fabric不再支持的Twitter SDK版本。具体做法是:
//twitter login
implementation('com.twitter.sdk.android:twitter-core:1.6.6@aar') {
transitive = true
}
implementation('com.twitter.sdk.android:twitter:1.13.1@aar') {
transitive = true
}
您应该更新到版本3.x上的Twitter's新SDK。
答案 1 :(得分:1)
要跳过在Crashlytics上运行ProGuard,只需将以下内容添加到ProGuard配置文件中即可。
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
接下来,为了提供最有意义的崩溃报告,请将以下行添加到配置文件中:
-keepattributes SourceFile,LineNumberTable
如果没有此规则,Crashlytics仍然可以正常运行,但您的崩溃报告将不包含正确的文件名或行号。
如果您使用自定义例外,请添加此行,以便在模糊处理期间跳过自定义例外类型:
-keep public class * extends java.lang.Exception