Build.gradle文件:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example"
minSdkVersion 15
targetSdkVersion 23
versionCode 11
versionName "1"
multiDexEnabled true
}
buildTypes {
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
compile files('libs/sinch-android-rtc-3.9.5.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
compile 'com.github.orhanobut:logger:1.12'
compile 'com.viewpagerindicator:library:2.4.1@aar'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.stripe:stripe-android:+'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.timehop.stickyheadersrecyclerview:library:0.4.3@aar'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.google.android.gms:play-services-wallet:8.4.0'
compile 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
这是我的proguard-rules.pro:
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.billing.IInAppBillingService
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
-libraryjars libs
# The official support library.
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
-keep class android.support.v7.widget.SearchView { *; }
-keep class com.viewpagerindicator.** { *; }
-keep interface com.viewpagerindicator.** { *; }
-dontwarn com.amazonaws.**
-dontwarn okio.**
-dontwarn com.squareup.**
-dontwarn com.zendesk.**
-dontwarn com.viewpagerindicator.LinePageIndicator
-dontwarn retrofit2.**
-dontwarn rx.**
-dontwarn uk.co.senab.**
-dontwarn com.octo.**
-keep class com.example.datamodel.** { *; }
-dontwarn org.xmlpull.v1.**
-dontwarn okhttp3.internal.huc.HttpURLConnectionImpl
-dontwarn okhttp3.**
-dontwarn retrofit.**
-dontwarn retrofit.appengine.UrlFetchClient
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
-keepattributes Signature
-keepattributes *Annotation*
这个编译很好,但我的应用程序总是在任何网络调用后崩溃。这是我收到的堆栈痕迹之一:
--------
- beginning of crash
06-30 11:44:36.144 4228-4228/com.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example, PID: 4228
java.lang.InternalError
at d.d.d.b.y.a(Unknown Source)
at d.d.d.b.x.<clinit>(Unknown Source)
at d.d.a.t.<init>(Unknown Source)
at d.d.a.s.a(Unknown Source)
at d.d.a.s.a(Unknown Source)
at d.j.a(Unknown Source)
at d.j.a(Unknown Source)
at d.h.a(Unknown Source)
at d.h.b(Unknown Source)
at d.h.a(Unknown Source)
at com.example.loginsignup.a.a.a(Unknown Source)
at com.example.loginsignup.view.LoginActivity.e(Unknown Source)
at com.example.loginsignup.view.LoginActivity.onClick(Unknown Source)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NoSuchFieldException: No field producerIndex in class Ld/d/d/b/x; (declaration of 'd.d.d.b.x' appears in /data/app/com.exmaple/base.apk)
at java.lang.Class.getDeclaredField(Native Method)
at d.d.d.b.y.a(Unknown Source)
at d.d.d.b.x.<clinit>(Unknown Source)
at d.d.a.t.<init>(Unknown Source)
at d.d.a.s.a(Unknown Source)
at d.d.a.s.a(Unknown Source)
at d.j.a(Unknown Source)
at d.j.a(Unknown Source)
at d.h.a(Unknown Source)
at d.h.b(Unknown Source)
at d.h.a(Unknown Source)
at com.example.loginsignup.a.a.a(Unknown Source)
at com.example.loginsignup.view.LoginActivity.e(Unknown Source)
at com.example.loginsignup.view.LoginActivity.onClick(Unknown Source)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-30 11:46:45.740 4228-4228/com.example I/Process: Sending signal. PID: 4228 SIG: 9
我一直在互联网上搜索不同的支持库等,但似乎没有什么能完全解决我的问题。我怀疑应用程序因为okhttp3而崩溃。 任何帮助,将不胜感激。使用minifyenabled false
编译时,我没有收到任何错误或崩溃