proguard配置问题,求解析

通过指定数量的优化能执行

-optimizationpasses 5

混淆时不会产生形形色色的类名

-dontusemixedcaseclassnames

指定不去忽略非公共的库类

-dontskipnonpubliclibraryclasses

不预校验

-dontpreverify

优化选项

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-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.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native ;
}

-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public (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 *;

}

#--------------------------

保护类型 -keepattributes 说明

Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable,

LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations,

RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, and AnnotationDefault

--------------------

-keepattributes **
-libraryjars /lib/rt.jar

#第三方类库
-dontwarn android.**
-keep class android.** {*;}
-dontwarn com.baidu.**
-keep class com.baidu.** {*;}
-dontwarn com.tencent.**
-keep class com.tencent.** {*;}
-dontwarn com.lidroid.**
-keep class com.lidroid.** {*;}
-dontwarn com.sina.**
-keep class com.sina.** {*;}
-dontwarn com.weibo.**
-keep class com.weibo.** {*;}
-dontwarn com.baidu.mapapi.**
-keep class com.baidu.mapapi.** {*;}
-dontwarn android.webkit.**
-keep class android.webkit.**{*;}
-dontwarn android.net.http.**
-keep class android.net.http.** { ;}
-libraryjars libs/android-support-v4.jar
-dontwarn android.support.v4.
*

-keep class android.support.v4.** { ; }

-keep interface android.support.v4.app.
* { *; }

删除Log代码

-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** i(...);
public static *** d(...);
public static *** w(...);
public static *** e(...);
}

com.android.ide.eclipse.adt.internal.build.DexException: Conversion to Dalvik format failed with error 1

at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:825)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:274)
at com.android.ide.eclipse.adt.internal.project.ExportHelper$2.run(ExportHelper.java:373)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

java.lang.IllegalStateException: Could not remove /projectName/bin/res/crunch/drawable-hdpi/ic_launcher.png
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.revertResources(RevertResourceManager.java:65)
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.runInWorkspace(RevertResourceManager.java:85)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

小黑oschina博客

2个回答

com.android.ide.eclipse.adt.internal.build.DexException: Conversion to Dalvik format failed with error 1
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:825)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:274)
at com.android.ide.eclipse.adt.internal.project.ExportHelper$2.run(ExportHelper.java:373)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
java.lang.IllegalStateException: Could not remove /projectName/bin/res/crunch/drawable-hdpi/ic_launcher.png
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.revertResources(RevertResourceManager.java:65)
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.runInWorkspace(RevertResourceManager.java:85)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

com.android.ide.eclipse.adt.internal.build.DexException: Conversion to Dalvik format failed with error 1
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:825)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:274)
at com.android.ide.eclipse.adt.internal.project.ExportHelper$2.run(ExportHelper.java:373)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
java.lang.IllegalStateException: Could not remove /projectName/bin/res/crunch/drawable-hdpi/ic_launcher.png
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.revertResources(RevertResourceManager.java:65)
at org.tigris.subversion.subclipse.core.resourcesListeners.RevertResourceManager$RevertWorkspaceJob.runInWorkspace(RevertResourceManager.java:85)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐