当构建apk时,花了太长时间..因为":app:transformClassesAndResourcesWithProguardForDebug"

时间:2018-06-14 09:15:41

标签: proguard android-build

我正在申请一个项目。

应用程序非常大,但apk版本耗时太长。

(:app:transformClassesAndResourcesWithProguardForDebug 1h 15m 48s 816ms)

最终我不得不停下来。

我的' proguard-rules'如下,我想知道原因。

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-dontoptimize
-dontpreverify
-dontshrink
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keepattributes Exceptions,InnerClasses,Deprecated,EnclosingMethod
-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.app.backup.BackupAgent
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
-libraryjars libs
-keepclasseswithmembernames class * {
    native <methods>;
}
-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);
    public void set*(...);
}
-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.app.Activity {
   public void *(android.view.View);
}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
    public static <fields>;
}
-dontwarn android.support.**
-keepclassmembers class * {
  @com.google.api.client.util.Key <fields>;
}
-keep class com.google.api.services.*.model.*
-keep class com.google.api.client.**
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
-dontwarn com.google.common.collect.MinMaxPriorityQueue
-dontobfuscate
-dontwarn com.google.android.analytics.**
-dontwarn com.google.common.**
-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry
-keep class com.google.analytics.tracking.android.CampaignTrackingReceiver
-keep class * extends java.util.ListResourceBundle {
    protected java.lang.Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}
-keep class com.google.android.gms.** { *;}
-keep class com.google.gson.** { *;}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}
-keep class com.crashlytics.** { *; }
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}
-keep class com.android.volley.** { *; }
-keep interface com.android.volley.** { *; }
-keep class org.apache.commons.logging.Log
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keep class com.kbeanie.** { *; }
-keep class com.sromku.simple.fb.** {
*;
}
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.facebook.** { *; }
-keep class io.card.** { *; }
-keep class com.androidquery.** { *; }
-keep class pl.tajchert.buswear.** { *; }
-keep class pl.tajchert.buswear.wear.** { *; }
-keep class com.viewpagerindicator.** {*; }
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-keep class com.squareup.** {*; }
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}
-keep class com.kakao.** { *; }
-keepattributes Signature
-keepclassmembers class * {
  public static <fields>;
  public *;
}
-dontwarn android.support.v4.**
-dontwarn com.ning.http.client.**
-dontwarn org.jboss.netty.**
-dontwarn org.slf4j.**
-dontwarn com.fasterxml.jackson.databind.**
-dontwarn com.google.android.gms.**
-keep class sun.misc.Unsafe { *; }
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}
-keepclassmembers class com.samsung.** { *; }
-keep class com.samsung.** { *; }
-dontwarn com.samsung.**
-keep class myApp.** { *; }
-dontwarn io.airbridge.**
-keep class io.airbridge.** {*;}
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep class bo.app.** { *; }
-keep class com.appboy.** { *; }
-dontwarn kotlin.**
-keepnames class com.google.android.gms.common.GoogleApiAvailability
-dontwarn com.appsflyer.**
-dontwarn com.android.installreferrer
-keep public class com.google.firebase.iid.FirebaseInstanceId {
    public *;
}
-keep public class com.google.android.gms.iid.InstanceID {
    public *;
}

应用程序中有很多未解决的资源。

帮助..

1 个答案:

答案 0 :(得分:0)

自我答案

我只是想完成应用构建。而且我可以写“ dontwarn **”。

然后我可以看到proguard的优化性能。

写下“ dontwarn **”后,检查每个类。

我希望这些愚蠢的问题和答案能对您有所帮助。 :)