如何使用proguard apk解决android studio latest version?

How to solve android studio latest version using proguard apk?

  1. build.gradle(项目)

    buildscript {
        ext.support_version = '27.0.3'
        ext.play_service_version = '11.8.0'
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com/'
            }
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0-alpha07'
            classpath 'com.google.gms:google-services:3.1.1'
            classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }
    allprojects {
        repositories {
            jcenter()
            google()
            maven {
                url 'https://maven.google.com/'
            }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
  2. build.gradle(应用程序)

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "xxx.com.xxooking"
            minSdkVersion 14
            targetSdkVersion 25
            versionCode 3
            versionName "0.4"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        lintOptions {
            checkReleaseBuilds false
        }
    }
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation 'com.android.support:appcompat-v7:27.1.0'
        implementation 'com.android.support:design:27.1.0'
        implementation 'com.squareup.retrofit2:retrofit:2.0.2'
        implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
        implementation 'com.squareup.retrofit:retrofit:1.9.0'
        implementation 'com.orhanobut:dialogplus:1.11@aar'
        implementation 'com.google.android.gms:play-services-base:11.8.0'
        implementation 'com.google.android.gms:play-services-location:11.8.0'
        implementation 'com.google.android.gms:play-services-maps:11.8.0'
        implementation 'com.google.android.gms:play-services-places:11.8.0'
        implementation 'com.squareup.picasso:picasso:2.5.2'
        implementation 'com.google.firebase:firebase-database:11.8.0'
        implementation 'com.nineoldandroids:library:2.4.0'
        implementation 'com.daimajia.slider:library:1.1.5@aar'
        implementation 'com.applozic.communication.uiwidget:mobicomkitui:4.85'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation('com.android.support:design:27.0.0') {
            exclude module: "com.android.support:design"
        }
    }
    
  3. Proguard-rules-pro

    -dontusemixedcaseclassnames
    -dontskipnonpubliclibraryclasses
    -verbose
    

错误:

//// com.google.firebase.messaging.RemoteMessage: can't find superclass or interface com.google.android.gms.common.internal.safeparcel.zza  
retrofit.RxSupport: can't find superclass or interface rx.Observable$OnSubscribe
retrofit.client.OkClient: can't find superclass or interface com.squareup.okhttp.RequestBody
com.google.firebase.iid.zzb: can't find referenced method 'MessengerCompat(android.os.Handler)' in program class com.google.android.gms.iid.MessengerCompat
com.google.firebase.iid.zzb: can't find referenced method 'android.os.IBinder getBinder()' in program class com.google.android.gms.iid.MessengerCompat
com.google.firebase.iid.zzb: can't find referenced method 'int zzc(android.os.Message)' in program class com.google.android.gms.iid.MessengerCompat
com.google.firebase.iid.zzh: can't find referenced method 'java.io.File getNoBackupFilesDir(android.content.Context)' in program class com.google.android.gms.common.util.zzw
com.google.firebase.messaging.RemoteMessage: can't find referenced class com.google.android.gms.common.internal.safeparcel.zza
com.google.firebase.messaging.zza: can't find referenced method 'boolean zzyH()' in program class com.google.android.gms.common.util.zzs
com.google.firebase.messaging.zzb: can't find referenced class com.google.android.gms.measurement.AppMeasurement
com.google.firebase.messaging.zzb: can't find referenced class com.google.android.gms.measurement.AppMeasurement$zza
com.google.firebase.messaging.zzb: can't find referenced class com.google.android.gms.measurement.AppMeasurement$zze
com.google.firebase.messaging.zzb: can't find referenced class com.google.android.gms.measurement.AppMeasurement$zzg
com.google.firebase.messaging.zzb: can't find referenced class com.google.android.gms.measurement.AppMeasurement
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzb
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzb$zza
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzc
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzb
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzb$zza
com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.common.internal.safeparcel.zzc
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
retrofit.RestMethodInfo$RxSupport: can't find referenced class rx.Observable
retrofit.RxSupport: can't find referenced class rx.Observable
retrofit.RxSupport: can't find referenced class rx.Observable$OnSubscribe
retrofit.RxSupport: can't find referenced class rx.Observable
retrofit.RxSupport: can't find referenced class rx.Subscriber
retrofit.RxSupport: can't find referenced class rx.subscriptions.Subscriptions
retrofit.RxSupport: can't find referenced class rx.Subscriber
retrofit.RxSupport: can't find referenced class rx.Observable$OnSubscribe
retrofit.RxSupport: can't find referenced class rx.subscriptions.Subscriptions
retrofit.RxSupport: can't find referenced class rx.Observable
retrofit.RxSupport: can't find referenced class rx.Subscriber
retrofit.RxSupport: can't find referenced class rx.Observable$OnSubscribe
retrofit.RxSupport: can't find referenced class rx.Subscriber
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Call
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Call
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.RequestBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.RequestBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
there were 223 unresolved references to classes or interfaces.

问题:

Proguard 第一次显示 Lint 相关错误,所以我在 build.gradle(app) 文件中添加以下行。

proguard 时间后显示所有库警告消息而不是 proguard apk(没有 proguard apk 工作正常)

Changes apply both files

> build.gradle (project)

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

/// > 2) Build.gradle(应用程序) 更改目标 SDK 版本 27 实施 'com.android.support:appcompat-v7:27.1.0' 实施 'com.android.support:design:27.1.0'