1
votes

I want to protect my application from reverse enginnering. When I create apk by export, it not create.I have added some libraries in projects, they are placed in libs folder & google-play-sevice library.I have following errors in console.

Please tell me about solution of that.

Console Errors

[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 *;
}

After comment -injars bin/classes & added libraries by this way -libraryjars libs/android-support-v4.jar apk is created, but not crash after install.

Crash report

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)
1
Try to check this solution stackoverflow.com/questions/9279213/… due to -injars bin/classesecle
@eee after comment this line & added by this way -libraryjars libs/twitter4j-async-3.0.3.jar -libraryjars libs/android-support-v4.jar apk is created.But still not install on device.user2251725

1 Answers

2
votes

The build process also automatically specifies all -injars, -outjars, and -libraryjars for you. You mustn't specify them again.

In Eclipse, you may need to check that all libraries are exported, so they are processed by ProGuard and included in the final apk.