App doesn't work if proguard function is enabled in android

My project works fine on Android device and emulator.

But, if I exported and grabbed the .apk file after you activated the proguard app, I cannot install this .apk file using proguard.

My guess is Service is not being called when the .apk file is installed and I was getting no errors in my log.

Please share your ideas.

Here is my proguard file.

-optimizationpasses 5
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dontoptimize
# -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-libraryjars /usr/local/android-sdk/add-ons/google_apis-7_r01/libs/maps.jar

-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

-keepattributes JavascriptInterface

-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 *;
}
-keep class mypackage.MyCallbackClass {
    void myCallbackMethod(java.lang.String);
}

-dontwarn android.support.**
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry

      

and my ** project.properties ** file

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}\\tools\\proguard\\proguard-android.txt:proguard-project.txt
#proguard.config=proguard.cfg
# Project target.
target=Google Inc.:Google APIs:11
android.library.reference.1=../Library1
android.library.reference.2=../Library2

      

Please share your ideas.

Thank.

+3


source to share


3 answers


I assume you are signing this version with a release key. If you have an older installation installed on your phone (with a debug key) uninstall it first. (You cannot have the same app with two different signatures on your device)



0


source


DATA FAILURE usually occurs when you have overflowed the binding process. If you are not using large bitmaps in your splash page (which is the most common reason for a failed binder transaction) then it might be a ParcelFormatException as I notice you are trying to use Parcelable in your apk.



0


source


Assuming you keep the ADT up to date.

If you build a version of your application using Eclipse export, it will load Proguard settings from the file specified by the property proguard.config

in project.properties

.

If you are using ant release

it will load the Proguard settings from the file specified by the property proguard.config

in ant.properties

.

Do you get any errors or warnings while doing this? They are especially useful when diagnosing Proguard, as the goal is to remove classes and methods that it thinks your application is not using.

I will uninstall my apps using:

adb shell pm uninstall -k com.*example*.*app*

      

And reinstall using:

adb install App-release.apk

      

If it gives a compatibility error, I discard the previous application data, excluding the key -k

from the delete command:

adb shell pm uninstall com.*example*.*app*

      

0


source







All Articles