1
我想保護我的應用程序免受逆向工程。當我通過導出創建apk時,它不會創建。我在項目中添加了一些庫,它們被放置在庫文件夾& google-play-sevice library.I在控制檯中有以下錯誤。如何創建apk與proguard啓用
請告訴我有關解決方案。
控制檯錯誤
[2013-09-27 12:20:45 - Fishing_log] Proguard returned with error code 1. See console
[2013-09-27 12:20:45 - Fishing_log] java.io.IOException: Can't write [C:\Users\owner\AppData\Local\Temp\android_7397078648251854298.jar] (Can't read [C:\Users\owner\AppData\Local\Temp\android_7626178264196017495.jar] (Duplicate zip entry [android_7626178264196017495.jar:com/fishing/BaseActivity$1.class]))
[2013-09-27 12:20:45 - Fishing_log] at proguard.OutputWriter.writeOutput(OutputWriter.java:264)
[2013-09-27 12:20:45 - Fishing_log] at proguard.OutputWriter.execute(OutputWriter.java:160)
[2013-09-27 12:20:45 - Fishing_log] at proguard.ProGuard.writeOutput(ProGuard.java:373)
[2013-09-27 12:20:45 - Fishing_log] at proguard.ProGuard.execute(ProGuard.java:154)
[2013-09-27 12:20:45 - Fishing_log] at proguard.ProGuard.main(ProGuard.java:484)
[2013-09-27 12:20:45 - Fishing_log] Caused by: java.io.IOException: Can't read [C:\Users\owner\AppData\Local\Temp\android_7626178264196017495.jar] (Duplicate zip entry [android_7626178264196017495.jar:com/fishing/BaseActivity$1.class])
[2013-09-27 12:20:45 - Fishing_log] at proguard.InputReader.readInput(InputReader.java:232)
[2013-09-27 12:20:45 - Fishing_log] at proguard.InputReader.readInput(InputReader.java:202)
[2013-09-27 12:20:45 - Fishing_log] at proguard.OutputWriter.writeOutput(OutputWriter.java:253)
[2013-09-27 12:20:45 - Fishing_log] ... 4 more
[2013-09-27 12:20:45 - Fishing_log] Caused by: java.io.IOException: Duplicate zip entry [android_7626178264196017495.jar:com/fishing/BaseActivity$1.class]
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.JarWriter.getOutputStream(JarWriter.java:139)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.JarReader.read(JarReader.java:65)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2013-09-27 12:20:45 - Fishing_log] at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2013-09-27 12:20:45 - Fishing_log] at proguard.InputReader.readInput(InputReader.java:228)
[2013-09-27 12:20:45 - Fishing_log] ... 6 more
proguard的-project.txt
-injars bin/classes
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-repackageclasses ''
-dontnote
-verbose
-dontwarn **CompatHoneycomb
-dontwarn twitter4j.**
-dontwarn com.google.android.gms.**
-dontwarn org.**
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontwarn sun.misc.Unsafe, java.lang.management.ManagementFactory, org.codehaus.jackson.JsonParser, org.json.JSONObject, org.codehaus.jackson.JsonGenerator, org.codehaus.jackson.JsonFactory, com.google.common.collect.MinMaxPriorityQueue
-keepattributes *Annotation*
-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.preference.PreferenceActivity
-keep public class * extends android.app.Dialog
-keep class * implements android.text.*
-keep class com.fo.fishing.asyntask.*
-keep class com.fo.fishing.utils.*
-keep public interface com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-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();
}
#Keep the R
-keepclassmembers class **.R$* {
public static <fields>;
}
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
評論-injars斌/班後 &添加庫通過這種方式-libraryjars庫/安卓-support-v4.jar apk已創建,但不會在安裝後崩潰湖
崩潰報告
STACK_TRACE=java.lang.AbstractMethodError: abstract method not implemented
at org.acra.jraf.android.util.activitylifecyclecallbackscompat.a.onActivityCreated(Unknown Source)
at android.app.Application.dispatchActivityCreated(Application.java:162)
at android.app.Activity.onCreate(Activity.java:865)
at android.support.v4.app.FragmentActivity.onCreate(Unknown Source)
at com.fishing.Login.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:4470)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.access$600(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
嘗試檢查此解決方案http://stackoverflow.com/questions/9279213/android-proguard-duplicate-zip-entry-error由於'-injars bin/classes' – ecle
@eee在評論此行後添加這樣-libraryjars libs/twitter4j-async-3.0.3.jar -libraryjars libs/android-support-v4.jar apk已創建。但仍未安裝在設備上。 – user2251725