Android Proguard Compatibility Library

Hello, I am writing an application using the compatibility library, and I am using the presentation pager in the application. I also use the action library that I got from this link

https://github.com/johannilsson/android-actionbar

My proguard.cfg file is as follows

-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -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 #keep all classes that might be used in XML layouts -keep public class * extends android.view.View -keep public class * extends android.app.Fragment -keep public class * extends android.support.v4.Fragment #keep all public and protected methods that could be used by java reflection -keepclassmembernames class * { public protected <methods>; } -keepclasseswithmembernames class * { native <methods>; } -keepclasseswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -dontwarn **CompatHoneycomb -dontwarn org.htmlcleaner.* 

and then my defualt.properties look like

 # 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 use, # "build.properties", and override values to adapt the script to your # project structure. # Project target. target=android-8 android.library.reference.1=../android-actionbar/actionbar proguard.config=proguard.cfg 

However, when I run to compile and sign my application, I get a dialog that reads "Proguard returned with error code 1. See console."

So I'm looking at a console that reads the following

 [2011-11-01 01:48:39 - Test App] Proguard returned with error code 1. See console [2011-11-01 01:48:39 - Test App] proguard.ParseException: Unknown option 'Manager' in argument number 9 [2011-11-01 01:48:39 - Test App] at proguard.ConfigurationParser.parse(ConfigurationParser.java:170) [2011-11-01 01:48:39 - Test App] at proguard.ProGuard.main(ProGuard.java:491) 

But does that really not mean a lot to me, and I donโ€™t know what I have to do to get this to work? Any ideas that I used this proguard script before in an application that didn't use the compatibility library, however, I got the script from saying that it should work with the compatibility library, but it doesn't? Anyone have ideas that would be greatly appreciated.

=== EDIT ===

After removing spaces from my build path, I was able to get a little further, but still failed with error 1, now a new list of errors appeared in the console, which now looks like this.

 [2011-11-01 14:01:20 - TestApp] Proguard returned with error code 1. See console [2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find superclass or interface android.os.Parcelable$ClassLoaderCreator [2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator [2011-11-01 14:01:20 - TestApp] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator [2011-11-01 14:01:20 - TestApp] Warning: there were 3 unresolved references to classes or interfaces. [2011-11-01 14:01:20 - TestApp] You may need to specify additional library jars (using '-libraryjars'), [2011-11-01 14:01:20 - TestApp] or perhaps the '-dontskipnonpubliclibraryclasses' option. [2011-11-01 14:01:20 - TestApp] java.io.IOException: Please correct the above warnings first. [2011-11-01 14:01:20 - TestApp] at proguard.Initializer.execute(Initializer.java:308) [2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.initialize(ProGuard.java:210) [2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.execute(ProGuard.java:85) [2011-11-01 14:01:20 - TestApp] at proguard.ProGuard.main(ProGuard.java:499) 
+4
source share
2 answers

I assume that your path to the project contains spaces (and in this case, the word manager). The latest Android plugin for Eclipse (ADT R14) still has issues with paths containing spaces for ProGuard. Alternative work options:

  • Use an Ant-based command line command. The problem should be solved there.
  • Install ProGuard 4.7 beta2 (or later). This is milder for missing quotes around file names containing spaces. You can simply download release and copy banks from proguard / lib to android-sdk / tools / proguard / lib.
  • Use the path to the project without spaces.
+5
source

This may be a bit, but what I did when I had this problem:

  • Update ADT Plugin for Eclipse
  • Install the latest version of ProGuard in android-sdk / tools / proguard
  • Create a new project in Eclipse and copy all classes and resources into a new project
  • Set up proguard in a new project
  • Export

I do not know that the previous project did not work, but I know that the trick worked for me. I hope this helps

0
source

Source: https://habr.com/ru/post/1379081/


All Articles