在Android应用程序中使用MultiDex运行ProGuard两次,第二次使用WarningsNotes?

在Android应用程序中使用MultiDex运行ProGuard两次,第二次使用WarningsNotes?,第1张

概述我在我的 Android应用程序中使用MultiDex和ProGuard.当我运行我的应用程序时,事实证明proguard运行了两次.以下是proguard运行之后的任务: :app:transformClassesAndResourcesWithProguardForReleaseProGuard, version 5.2.1...Initializing...Shrinking... 我在我的 Android应用程序中使用MultIDex和ProGuard.当我运行我的应用程序时,事实证明proguard运行了两次.以下是proguard运行之后的任务:

:app:transformClassesAndResourcesWithProguardForReleaseProGuard,version 5.2.1...Initializing...Shrinking...Obfuscating...Writing output...

然后:

:app:transformClassesWithMultIDexListForReleaseProGuard,version 5.2.1

这是我的应用程序的build.gradle文件:

buildscript {    repositorIEs {        maven { url 'https://maven.fabric.io/public' }    }    dependencIEs {        classpath 'io.fabric.tools:gradle:1.20.1'    }}apply plugin: 'com.androID.application'apply plugin: 'io.fabric'apply plugin: 'com.Google.gms.Google-services'androID {    compileSdkVersion 23    buildToolsversion "23.0.1"    defaultConfig {        applicationID "de.majestella"        minSdkVersion 16        targetSdkVersion 22        versionCode 3        versionname "1.0.1"        // Enabling multIDex support.        multIDexEnabled true    }    dexOptions {        incremental true        javaMaxHeapSize "2g"    }    buildTypes {        deBUG {            deBUGgable true            // ProGuard            MinifyEnabled false        }        release {                signingConfig signingConfigs.release                deBUGgable false                // ProGuard                MinifyEnabled true                proguardfiles getDefaultProguardfile('proguard-androID.txt'),'proguard-rules.pro','proguard-guava.pro','proguard-square-picasso.pro','proguard-crashlytics.pro','proguard-Google-analytics.pro'       }    }}repositorIEs {    mavenCentral()    maven {        name = "sonatype"        url = "https://oss.sonatype.org/content/repositorIEs/snapshots/"    }    maven {        name = "sonatypeGoogle"        url = "https://oss.sonatype.org/content/repositorIEs/Google-snapshots/"    }    flatDir {        dirs 'libs'    }    maven { url 'https://maven.fabric.io/public' }}dependencIEs {    compile filetree(dir: 'libs',include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.androID.support:appcompat-v7:23.0.1'    compile 'com.androID.support:design:23.0.1'    compile('com.crashlytics.sdk.androID:crashlytics:2.5.2@aar') {        transitive = true;    }    compile 'com.androID.support:multIDex:1.0.1'    compile 'com.Google.androID.gms:play-services-analytics:8.1.0'    compile "com.Google.androID.gms:play-services:8.1.0"}

在第一个proguard运行之后(即,在:app:transformClassesAndResourcesWithProguardForRelease之后)我在写入输出后得到以下警告,因此proguard本身在我的规则下工作正常:

Warning: can't write resource [fabric/com.crashlytics.sdk.androID.answers.propertIEs] (Duplicate zip entry [fabric/com.crashlytics.sdk.androID.answers.propertIEs])Warning: can't write resource [fabric/com.crashlytics.sdk.androID.beta.propertIEs] (Duplicate zip entry [fabric/com.crashlytics.sdk.androID.beta.propertIEs])Warning: can't write resource [fabric/com.crashlytics.sdk.androID.crashlytics-core.propertIEs] (Duplicate zip entry [fabric/com.crashlytics.sdk.androID.crashlytics-core.propertIEs])Warning: can't write resource [fabric/com.crashlytics.sdk.androID.crashlytics.propertIEs] (Duplicate zip entry [fabric/com.crashlytics.sdk.androID.crashlytics.propertIEs])Warning: can't write resource [fabric/io.fabric.sdk.androID.fabric.propertIEs] (Duplicate zip entry [fabric/io.fabric.sdk.androID.fabric.propertIEs])

当第二个proguard运行发生之后:app:transformClassesWithMultIDexListForRelease我得到以下内容:

Note: androID.support.design.Widget.CoordinatorLayout calls 'Class.getAnnotation'Note: com.Google.ads.mediation.MediationServerParameters calls 'FIEld.getAnnotation'Note: com.Google.common.eventbus.AnnotatedSubscriberFinder calls 'Method.getAnnotation'Note: com.Google.common.reflect.Invokable$MethodInvokable calls 'Method.getParameterannotations'Note: d.a.a.a.c calls 'Class.getAnnotation'Note: d.a.a.a.i calls 'Class.getAnnotation'Note: androID.support.v4.app.ak calls 'FIEld.getType'Note: com.Google.androID.gms.internal.zzsf calls 'FIEld.getType'...

这很奇怪,因为在第一次比赛中,由于我的规则,我没有得到这样的警告/注释.

以下是我的ProGuard规则:

-keep class com.Google.common.io.Resources {    public static <methods>;}-keep class com.Google.common.collect.Lists {    public static ** reverse(**);}-keep class com.Google.common.base.Charsets {    public static <fIElds>;}-keep class com.Google.common.collect.MapMakerInternalMap$ReferenceEntry-keep class com.Google.common.cache.LocalCache$ReferenceEntry-dontwarn sun.misc.Unsafe-dontwarn com.Google.common.collect.MinMaxPriorityQueue-keepattributes Sourcefile,lineNumbertable,*Annotation*-keep class com.crashlytics.androID.**-dontwarn com.squareup.okhttp.**-dontnote org.apache.http.conn.**-dontnote org.apache.http.params.**-dontnote androID.net.http.**-dontnote **IlicensingService-dontnote com.androID.vending.billing.IInAppBillingService-dontwarn com.Google.auto.factory.**-keepattributes Exceptions,InnerClasses,Signature,Deprecated,Sourcefile,*Annotation*,EnclosingMethod-dontnote androID.support.**-dontnote com.Google.common.util.concurrent.**-dontnote com.squareup.okhttp.**-keep class org.Jsoup.** { *; }-keeppackagenames org.Jsoup.nodes-keep class com.Google.common.cache.Striped64 { *; }-keep class com.Google.common.** { *; }-keep class com.daimajia.slIDer.** { *; }-dontnote org.Jsoup.**-dontnote com.Google.common.**-keep class com.squareup.picasso.** { *; }-keep class com.Google.androID.gms.** { *; }-keep class com.Google.ads.** { *; }-keep class com.lorentzos.** { *; }-keep public class com.Google.androID.gms.* { public *; }-dontwarn com.Google.androID.gms.**-dontnote com.Google.androID.gms.maps.internal.CreatorImpl-keep class com.mikepenz.iconics.** { *; }

在我看来,第二次ProGuard运行并没有使用我的proguard规则.

编辑:这是gradlew -q任务的结果–all:https://gist.github.com/confile/2a15d80980214656f4f1

为什么第二个Proguard运行会引发错误,我该如何解决?

解决方法 这似乎是androID gradle插件问题.见这 https://www.google.co.kr/url?sa=t&source=web&rct=j&url=https://groups.google.com/forum/m/%23!topic/adt-dev/iS_lyRH8hL8&ved=0ahUKEwiP7cP-nMHJAhXLp5QKHX3qBuwQFggdMAI&usg=AFQjCNF4ZuCA79SeCltd8kBIzArzeBbKsQ&sig2=UFqfkY_By7z1rCW4SwmQZw 总结

以上是内存溢出为你收集整理的在Android应用程序中使用MultiDex运行ProGuard两次,第二次使用Warnings / Notes?全部内容,希望文章能够帮你解决在Android应用程序中使用MultiDex运行ProGuard两次,第二次使用Warnings / Notes?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1125623.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存