Android에서 다음과 같은 설정을 사용합니다.Android Proguard에서 Java SE 라이브러리 제외
-dontpreverify
# Hold onto the mapping.text file, it can be used to unobfuscate stack traces in the developer console using the retrace tool
-printmapping mapping.txt
# Keep line numbers so they appear in the stack trace of the develeper console
-keepattributes SourceFile,LineNumberTable
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
# Activities, services and broadcast receivers are specified in the manifest file so they won't be automatically included
-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
# Custom view components might be accessed from your layout files
-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*(...);
}
# event handlers can be specified in the layout files e.g. android:onClick="nextButton_onClick", I borrowed this method name notation from .NET
-keepclassmembers class * extends android.app.Activity {
public void *_*(android.view.View);
}
# Parcelable implementations are accessed by introspection
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
# You might want to keep your annotations
-keepattributes *Annotation*
# I use Google Guava in my app
# see http://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava
-libraryjars libs/google/jsr305-1.3.9.jar;libs/pinyin4j/pinyin4j-2.5.0.jar
-dontwarn sun.misc.Unsafe
-keepclasseswithmembers class com.google.common.base.internal.Finalizer{
<methods>;
}
내 라이브러리 중 일부는 직접 자바 SE에서 수입 내가 난독에서 제외 할 수 있습니까
(JApplet에 예를 들면 포함)? 참고, pinyin4j-2.5.0.jar
라이브러리에 -libraryjars
이 있습니다. 나는 그것이 프로 가드에게 "이봐, 이건 도서관이다. 아무것도하지 마라."라고 말하는 방법이라고 생각했습니다. 하지만 프로 가드가 아직 처리하려고 시도하는 것 같습니다. pinyin4j-2.5.0.jar
다음 오류가 발생합니다.
Note: there were 125 duplicate class definitions.
Warning: demo.Pinyin4jAppletDemo: can't find superclass or interface javax.swing.JApplet
Warning: demo.Pinyin4jAppletDemo$1: can't find superclass or interface java.awt.event.WindowAdapter
Warning: demo.Pinyin4jAppletDemo$2: can't find superclass or interface java.awt.event.ActionListener
Warning: demo.Pinyin4jAppletDemo$3: can't find superclass or interface java.awt.event.ActionListener
Warning: org.jasypt.encryption.pbe.PBEBigDecimalCleanablePasswordEncryptor: can't find superclass or interface org.jasypt.encryption.pbe.PBEBigDecimalEncryptor
Warning: org.jasypt.encryption.pbe.PBEBigIntegerCleanablePasswordEncryptor: can't find superclass or interface org.jasypt.encryption.pbe.PBEBigIntegerEncryptor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyDescriptor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyDescriptor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyEditor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyEditor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyEditor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyEditorManager
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyDescriptor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.IntrospectionException
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyEditor
Warning: au.com.bytecode.opencsv.bean.CsvToBean: can't find referenced class java.beans.PropertyDescriptor
...
...
Warning: org.jasypt.normalization.Normalizer: can't find referenced class com.ibm.icu.text.Normalizer$Mode
You should check if you need to specify additional program jars.
Warning: there were 333 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Warning: there were 6 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
Error: Please correct the above warnings first.
당신의 일부는 (애플릿, 스윙처럼 ...) 안드로이드에서 사용할 수 없습니다 자바 SE 유일한 방법을 포함하는 라이브러리 항아리에 대한 것을 언급 할 수있다. Nope. 실제로 Java SE가 아닌 메소드를 사용하는 한 완벽하게 실행됩니다.
전체 오류 로그 여기에서 다운로드 할 수 있습니다 https://www.dropbox.com/s/dns62f7gp6unusg/error-log.txt
안드로이드는 이러한 클래스를 가지고 있지 않기 때문에 당신은 당신의 안드로이드 응용 프로그램에서 어쨌든 사용할 수 없습니다. – CommonsWare
나는이 라이브러리를 라이브러리로 포함한다고 가정 할 것이므로 그 라이브러리를'-libraryjars'에 추가 할 필요가있다.하지만 실제로 여기서 무엇을 하려는지는 모른다. 이 클래스는 안드로이드에서 작동하지 않습니다. – njzk2
모두는 도서관입니다. 사실, proguard를 소개하기 전에 (예 : pinyin4j-2.5.0.jar -> demo.Pinyin4jAppletDemo) 완벽하게 작동합니다. 그들이 작동하는 이유는 라이브러리에서 Java SE 전용 메소드를 사용하지 않는 메소드 만 사용하기 때문입니다. 이제 문제는 ProGuard가 내 모든 lib jar를 처리하고자하는 것입니다. –