2016-12-01 66 views
1

我試圖生成發佈apk同時啓用proguard。不生成發佈版本,而proguard啓用

我想很多的事情,我試圖通過下面的行添加到proguard-rule.pro文件

-dontwarn com.squareup.picasso.** 
-dontwarn okio.** 
-dontwarn retrofit2.Platform$Java8 
-dontwarn com.mixpanel.** 
-dontwarn org.acra.** 

在這種情況下產生的我發佈版本,但我的應用程序崩潰

如果我沒有添加任何行的ProGuard然後 我收到錯誤

Warning:com.mixpanel.android.mpmetrics.GCMReceiver: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification 
Warning:com.mixpanel.android.mpmetrics.Tweaks: can't find referenced class com.mixpanel.android.mpmetrics.Tweaks$TweakType 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient 
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache 
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 
Warning:okio.Okio: can't find referenced class java.nio.file.Files 
Warning:okio.Okio: can't find referenced class java.nio.file.Path 
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption 
Warning:okio.Okio: can't find referenced class java.nio.file.Path 
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption 
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 
Warning:okio.Okio: can't find referenced class java.nio.file.Path 
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption 
Warning:okio.Okio: can't find referenced class java.nio.file.Path 
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption 
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 
Warning:org.acra.ErrorReporter: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification 
Warning:retrofit2.Platform$Java8: can't find referenced method 'boolean isDefault()' in library class java.lang.reflect.Method 
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup 
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle 
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles 
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle 
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup 
Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 

     Maybe this is library field 'org.apache.commons.logging.impl.Jdk14Logger { java.lang.String name; }' 
Note: org.acra.collector.DisplayManagerCollector accesses a field 'DISPLAY_SERVICE' dynamically 
     Maybe this is library field 'android.content.Context { java.lang.String DISPLAY_SERVICE; }' 
Note: org.acra.collector.DisplayManagerCollector accesses a field 'densityDpi' dynamically 
     Maybe this is library field 'android.content.res.Configuration { int densityDpi; }' 
     Maybe this is library field 'android.util.DisplayMetrics { int densityDpi; }' 
Note: org.acra.collector.MediaCodecListCollector accesses a field 'colorFormats' dynamically 
     Maybe this is library field 'android.media.MediaCodecInfo$CodecCapabilities { int[] colorFormats; }' 
Note: org.acra.collector.MediaCodecListCollector accesses a field 'profileLevels' dynamically 
     Maybe this is library field 'android.media.MediaCodecInfo$CodecCapabilities { android.media.MediaCodecInfo$CodecProfileLevel[] profileLevels; }' 
Note: org.acra.collector.MediaCodecListCollector accesses a field 'profile' dynamically 
     Maybe this is library field 'android.media.MediaCodecInfo$CodecProfileLevel { int profile; }' 
Note: org.acra.collector.MediaCodecListCollector accesses a field 'level' dynamically 
     Maybe this is program field 'com.google.android.gms.internal.zzaf$zza { int level; }' 
     Maybe this is program field 'okhttp3.logging.HttpLoggingInterceptor { okhttp3.logging.HttpLoggingInterceptor$Level level; }' 
     Maybe this is library field 'android.media.MediaCodecInfo$CodecProfileLevel { int level; }' 
     Maybe this is library field 'android.net.wifi.ScanResult { int level; }' 
Note: the configuration keeps the entry point 'android.support.design.widget.NavigationView { void setNavigationItemSelectedListener(android.support.design.widget.NavigationView$OnNavigationItemSelectedListener); }', but not the descriptor class 'android.support.design.widget.NavigationView$OnNavigationItemSelectedListener' 
Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnLayoutChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener' 
Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnAttachStateChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener' 
Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setOnTabSelectedListener(android.support.design.widget.TabLayout$OnTabSelectedListener); }', but not the descriptor class 'android.support.design.widget.TabLayout$OnTabSelectedListener' 
Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setupWithViewPager(android.support.v4.view.ViewPager); }', but not the descriptor class 'android.support.v4.view.ViewPager' 
Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setTabsFromPagerAdapter(android.support.v4.view.PagerAdapter); }', but not the descriptor class 'android.support.v4.view.PagerAdapter' 
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setAdapter(android.support.v4.view.PagerAdapter); }', but not the descriptor class 'android.support.v4.view.PagerAdapter' 
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setOnAdapterChangeListener(android.support.v4.view.ViewPager$OnAdapterChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnAdapterChangeListener' 
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnPageChangeListener' 
Note: the configuration keeps the entry point 'android.support.v4.widget.DrawerLayout { void setDrawerListener(android.support.v4.widget.DrawerLayout$DrawerListener); }', but not the descriptor class 'android.support.v4.widget.DrawerLayout$DrawerListener' 
Note: the configuration keeps the entry point 'android.support.v4.widget.NestedScrollView { void setOnScrollChangeListener(android.support.v4.widget.NestedScrollView$OnScrollChangeListener); }', but not the descriptor class 'android.support.v4.widget.NestedScrollView$OnScrollChangeListener' 
Note: the configuration keeps the entry point 'android.support.v4.widget.SlidingPaneLayout { void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout$PanelSlideListener); }', but not the descriptor class 'android.support.v4.widget.SlidingPaneLayout$PanelSlideListener' 
Note: the configuration keeps the entry point 'android.support.v4.widget.SwipeRefreshLayout { void setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener); }', but not the descriptor class 'android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener' 
Note: the configuration keeps the entry point 'android.support.v7.view.menu.ActionMenuItemView { void setItemInvoker(android.support.v7.view.menu.MenuBuilder$ItemInvoker); }', but not the descriptor class 'android.support.v7.view.menu.MenuBuilder$ItemInvoker' 
Note: the configuration keeps the entry point 'android.support.v7.view.menu.ActionMenuItemView { void setPopupCallback(android.support.v7.view.menu.ActionMenuItemView$PopupCallback); }', but not the descriptor class 'android.support.v7.view.menu.ActionMenuItemView$PopupCallback' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionBarContainer { void setTabContainer(android.support.v7.widget.ScrollingTabContainerView); }', but not the descriptor class 'android.support.v7.widget.ScrollingTabContainerView' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionBarOverlayLayout { void setActionBarVisibilityCallback(android.support.v7.widget.ActionBarOverlayLayout$ActionBarVisibilityCallback); }', but not the descriptor class 'android.support.v7.widget.ActionBarOverlayLayout$ActionBarVisibilityCallback' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionMenuView { void setPresenter(android.support.v7.widget.ActionMenuPresenter); }', but not the descriptor class 'android.support.v7.widget.ActionMenuPresenter' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionMenuView { void setOnMenuItemClickListener(android.support.v7.widget.ActionMenuView$OnMenuItemClickListener); }', but not the descriptor class 'android.support.v7.widget.ActionMenuView$OnMenuItemClickListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActivityChooserView { void setActivityChooserModel(android.support.v7.widget.ActivityChooserModel); }', but not the descriptor class 'android.support.v7.widget.ActivityChooserModel' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ActivityChooserView { void setProvider(android.support.v4.view.ActionProvider); }', but not the descriptor class 'android.support.v4.view.ActionProvider' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ContentFrameLayout { void setAttachListener(android.support.v7.widget.ContentFrameLayout$OnAttachListener); }', but not the descriptor class 'android.support.v7.widget.ContentFrameLayout$OnAttachListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.FitWindowsFrameLayout { void setOnFitSystemWindowsListener(android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener); }', but not the descriptor class 'android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.FitWindowsLinearLayout { void setOnFitSystemWindowsListener(android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener); }', but not the descriptor class 'android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setAccessibilityDelegateCompat(android.support.v7.widget.RecyclerViewAccessibilityDelegate); }', but not the descriptor class 'android.support.v7.widget.RecyclerViewAccessibilityDelegate' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setAdapter(android.support.v7.widget.RecyclerView$Adapter); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$Adapter' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setRecyclerListener(android.support.v7.widget.RecyclerView$RecyclerListener); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$RecyclerListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$LayoutManager' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setRecycledViewPool(android.support.v7.widget.RecyclerView$RecycledViewPool); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$RecycledViewPool' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setViewCacheExtension(android.support.v7.widget.RecyclerView$ViewCacheExtension); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$ViewCacheExtension' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setChildDrawingOrderCallback(android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setOnScrollListener(android.support.v7.widget.RecyclerView$OnScrollListener); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$OnScrollListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView { void setItemAnimator(android.support.v7.widget.RecyclerView$ItemAnimator); }', but not the descriptor class 'android.support.v7.widget.RecyclerView$ItemAnimator' 
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView { void setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener); }', but not the descriptor class 'android.support.v7.widget.SearchView$OnQueryTextListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView { void setOnCloseListener(android.support.v7.widget.SearchView$OnCloseListener); }', but not the descriptor class 'android.support.v7.widget.SearchView$OnCloseListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView { void setOnSuggestionListener(android.support.v7.widget.SearchView$OnSuggestionListener); }', but not the descriptor class 'android.support.v7.widget.SearchView$OnSuggestionListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView { void setSuggestionsAdapter(android.support.v4.widget.CursorAdapter); }', but not the descriptor class 'android.support.v4.widget.CursorAdapter' 
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView$SearchAutoComplete { void setSearchView(android.support.v7.widget.SearchView); }', but not the descriptor class 'android.support.v7.widget.SearchView' 
Note: the configuration keeps the entry point 'android.support.v7.widget.Toolbar { void setOnMenuItemClickListener(android.support.v7.widget.Toolbar$OnMenuItemClickListener); }', but not the descriptor class 'android.support.v7.widget.Toolbar$OnMenuItemClickListener' 
Note: the configuration keeps the entry point 'android.support.v7.widget.ViewStubCompat { void setOnInflateListener(android.support.v7.widget.ViewStubCompat$OnInflateListener); }', but not the descriptor class 'android.support.v7.widget.ViewStubCompat$OnInflateListener' 
Note: the configuration keeps the entry point 'com.facebook.FacebookButtonBase { void setFragment(android.support.v4.app.Fragment); }', but not the descriptor class 'android.support.v4.app.Fragment' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setDefaultAudience(com.facebook.login.DefaultAudience); }', but not the descriptor class 'com.facebook.login.DefaultAudience' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setLoginBehavior(com.facebook.login.LoginBehavior); }', but not the descriptor class 'com.facebook.login.LoginBehavior' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setToolTipStyle(com.facebook.login.widget.ToolTipPopup$Style); }', but not the descriptor class 'com.facebook.login.widget.ToolTipPopup$Style' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setToolTipMode(com.facebook.login.widget.LoginButton$ToolTipMode); }', but not the descriptor class 'com.facebook.login.widget.LoginButton$ToolTipMode' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setProperties(com.facebook.login.widget.LoginButton$LoginButtonProperties); }', but not the descriptor class 'com.facebook.login.widget.LoginButton$LoginButtonProperties' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setLoginManager(com.facebook.login.LoginManager); }', but not the descriptor class 'com.facebook.login.LoginManager' 
Note: the configuration keeps the entry point 'com.facebook.login.widget.ProfilePictureView { void setOnErrorListener(com.facebook.login.widget.ProfilePictureView$OnErrorListener); }', but not the descriptor class 'com.facebook.login.widget.ProfilePictureView$OnErrorListener' 
Note: the configuration keeps the entry point 'com.facebook.share.internal.LikeBoxCountView { void setCaretPosition(com.facebook.share.internal.LikeBoxCountView$LikeBoxCountViewCaretPosition); }', but not the descriptor class 'com.facebook.share.internal.LikeBoxCountView$LikeBoxCountViewCaretPosition' 
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setLikeViewStyle(com.facebook.share.widget.LikeView$Style); }', but not the descriptor class 'com.facebook.share.widget.LikeView$Style' 
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setAuxiliaryViewPosition(com.facebook.share.widget.LikeView$AuxiliaryViewPosition); }', but not the descriptor class 'com.facebook.share.widget.LikeView$AuxiliaryViewPosition' 
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setHorizontalAlignment(com.facebook.share.widget.LikeView$HorizontalAlignment); }', but not the descriptor class 'com.facebook.share.widget.LikeView$HorizontalAlignment' 
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setOnErrorListener(com.facebook.share.widget.LikeView$OnErrorListener); }', but not the descriptor class 'com.facebook.share.widget.LikeView$OnErrorListener' 
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setFragment(android.support.v4.app.Fragment); }', but not the descriptor class 'android.support.v4.app.Fragment' 
Note: the configuration keeps the entry point 'com.google.android.gms.plus.PlusOneButton { void setOnPlusOneClickListener(com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener); }', but not the descriptor class 'com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener' 
Note: the configuration keeps the entry point 'com.google.firebase.iid.FirebaseInstanceId { com.google.firebase.iid.FirebaseInstanceId getInstance(com.google.firebase.FirebaseApp); }', but not the descriptor class 'com.google.firebase.FirebaseApp' 
Note: the configuration keeps the entry point 'com.mixpanel.android.surveys.CardCarouselLayout { void setOnQuestionAnsweredListener(com.mixpanel.android.surveys.CardCarouselLayout$OnQuestionAnsweredListener); }', but not the descriptor class 'com.mixpanel.android.surveys.CardCarouselLayout$OnQuestionAnsweredListener' 
Note: the configuration keeps the entry point 'com.soundcloud.android.crop.CropImageView { void setRecycler(com.soundcloud.android.crop.ImageViewTouchBase$Recycler); }', but not the descriptor class 'com.soundcloud.android.crop.ImageViewTouchBase$Recycler' 
Note: the configuration keeps the entry point 'com.soundcloud.android.crop.ImageViewTouchBase { void setRecycler(com.soundcloud.android.crop.ImageViewTouchBase$Recycler); }', but not the descriptor class 'com.soundcloud.android.crop.ImageViewTouchBase$Recycler' 
Note: there were 3 references to unknown classes. 
     You should check your configuration for typos. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass) 
Note: there were 32 classes trying to access generic signatures using reflection. 
     You should consider keeping the signature attributes 
     (using '-keepattributes Signature'). 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) 
Note: there were 3 classes trying to access enclosing classes using reflection. 
     You should consider keeping the inner classes attributes 
     (using '-keepattributes InnerClasses'). 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) 
Note: there were 59 unkept descriptor classes in kept class members. 
     You should consider explicitly keeping the mentioned classes 
     (using '-keep'). 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass) 
Note: there were 17 unresolved dynamic references to classes or interfaces. 
     You should check if you need to specify additional program jars. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) 
Note: there were 14 accesses to class members by means of introspection. 
     You should consider explicitly keeping the mentioned class members 
     (using '-keep' or '-keepclassmembers'). 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember) 
Warning:there were 40 unresolved references to classes or interfaces. 
     You may need to add missing library jars or update their versions. 
     If your code works fine without the missing classes, you can suppress 
     the warnings with '-dontwarn' options. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) 
Warning:there were 3 unresolved references to library class members. 
     You probably need to update the library versions. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember) 
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. 
:app:transformClassesAndResourcesWithProguardForRelease FAILED 
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. 
> java.io.IOException: Please correct the above warnings first. 
Information:BUILD FAILED 

這裏是我的gradle構建文件

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.0" 


    defaultConfig { 
     applicationId "com.electrovese.eduqueri" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    dexOptions{ 
     javaMaxHeapSize "4g" 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:support-v4:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.google.code.gson:gson:2.6.2' 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' 
    compile 'com.pixplicity.easyprefs:library:[email protected]' 
    compile 'com.android.support:recyclerview-v7:23.4.0' 
    compile 'com.squareup.picasso:picasso:2.4.0' 
    compile 'de.hdodenhof:circleimageview:2.1.0' 
    compile 'com.facebook.android:facebook-android-sdk:4.0.0' 
    compile 'ch.acra:acra:4.6.1' 
    compile 'com.google.android.gms:play-services-gcm:9.0.0' 
    compile 'com.google.android.gms:play-services-auth:9.0.0' 
    compile 'com.google.android.gms:play-services-plus:9.0.0' 
    compile 'com.kbeanie:image-chooser-library:[email protected]' 
    compile 'com.soundcloud.android:android-crop:[email protected]' 
    compile project(':payUMoneysdk') 
} 
apply plugin: 'com.google.gms.google-services' 
+0

你確定'的ProGuard .pro'與您的build.gradle位於相同的目錄中? –

+0

是的,proguard.pro在應用程序的目錄中 – ajit

回答

1

每一個通俗圖書館通常定義Proguard的規則。支持庫,Picasso,OkHttp,Retrofit都有他們的規則,下次在互聯網上查找它們。 -dontwarn只會掩蓋問題,通常不會解決問題。這次我把它們放在一起:

### Android Support 
-dontwarn android.support.** 

-dontwarn android.support.design.** 
-keep public class android.app.Notification 
-keep class android.support.design.** { *; } 
-keep interface android.support.design.** { *; } 
-keep public class android.support.design.R$* { *; } 

-keep public class android.support.v7.widget.** { *; } 
-keep public class android.support.v7.internal.widget.** { *; } 
-keep public class android.support.v7.internal.view.menu.** { *; } 

-keep public class * extends android.support.v4.view.ActionProvider { 
    public <init>(android.content.Context); 
} 

# Retrofit 2.X 
## https://square.github.io/retrofit/ ## 

-dontwarn retrofit2.** 
-keep class retrofit2.** { *; } 
-keepattributes Signature 
-keepattributes Exceptions 

-keepclasseswithmembers class * { 
    @retrofit2.http.* <methods>; 
} 

# OkHtpp 3 
-keepattributes Signature 
-keepattributes Annotation 
-keep class okhttp3.** { *; } 
-keep interface okhttp3.** { *; } 
-dontwarn okhttp3.** 
-dontwarn okio.** 

# Picasso 
-keep class com.squareup.picasso.** { *; } 
-keepclasseswithmembers class * { 
    @com.squareup.picasso.** *; 
} 
-keepclassmembers class * { 
    @com.squareup.picasso.** *; 
} 
-dontnote com.squareup.picasso.Utils 
-dontwarn com.squareup.picasso.OkHttpDownloader 

# Acra 
# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'. 
# Note: if you are removing log messages elsewhere in this file then this isn't necessary 
-keep class org.acra.ACRA { 
    *; 
} 

# keep this around for some enums that ACRA needs 
-keep class org.acra.ReportingInteractionMode { 
    *; 
} 

-keepnames class org.acra.sender.HttpSender$** { 
    *; 
} 

-keepnames enum org.acra.ReportField { 
    *; 
} 

# keep this otherwise it is removed by ProGuard 
-keep public class org.acra.ErrorReporter 
{ 
    public void addCustomData(java.lang.String,java.lang.String); 
    public void putCustomData(java.lang.String,java.lang.String); 
    public void removeCustomData(java.lang.String);} 

# keep this otherwise it is removed by ProGuard 
-keep public class org.acra.ErrorReporter 
{ 
    public void handleSilentException(java.lang.Throwable); 
} 
-dontwarn android.app.Notification 

這不會解決所有的問題。要知道,因爲這是工作太多導入我還沒有考慮到compile project(':payUMoneysdk')。當您遇到問題時,請將其複製粘貼到Google並首先搜索。

編輯:

爲了保持名稱中使用

-keepparameternames 

如果這不會幫助,然後添加這些規則太:

-keep class {your.package.name}.** { *; } 
-keepclassmembers class {your.package.name}.** { *; } 
+0

它的工作對我而言非常感謝 – ajit

+0

如果有幫助,請將答案投票並接受它。 –

+0

有問題它改變了所有api的參數,請幫我 – ajit

相關問題