proguard

With ProGuard, how do I obfuscate just one class?

蹲街弑〆低调 提交于 2019-12-03 00:05:56
What would be a smart ProGuard configuration to obfuscate just the private methods and constants of one particular class com.acme.Algorithm? I would like to obfuscate just that, because it contains an algorithm that should not be plain obvious when accidentally opening the .jar. I'm a ProGuard newbie. AFAIU, you have to use "keep", but the positive logic of "do obfuscate" is not available, right? So how to exlude my class from a "keep everything" config? Note: I don't want to obfuscate other classes for the moment, because I want to allow the customer to see meaningful stacktraces. Obfuscating

Keep annotated class in Proguard

元气小坏坏 提交于 2019-12-02 22:04:01
I have a bunch of classes that use e.g. an @Singleton annotation like so @Singleton public class ImageCache that I would like to keep. How can I configure a proguard -keep statement so it applies to all classes that have that annotation. Btw in terms of context I need this for an app using Roboguice on Android, which is why I added the tags. Might help others. ProGuard is based on a java-like configuration with wild-cards. It does require fully qualified class names. This should work: -keep @com.google.inject.Singleton public class * First define an annotation public @interface DoNotStrip {}

Android Studio & ProGuard: cannot resolve symbol getDefaultProguardFile?

半城伤御伤魂 提交于 2019-12-02 22:01:56
IDE : Android Studio 1.1.0 Subject : ProGuard Problem : ProGuard files or tools not recognized by Android Studio, getDefaultProguardFile can not be resolved and there's no proguard-android.txt and proguard-rules.txt files in the app, see the image below: (from build.gradle) How to fix this and achieve ProGuard protection to my App ? Try to change into - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' I had the same trouble as shown here: The error message makes it seem as if the file is not being found, and therefore not read. However, I went to into sdk

How can I obfuscate only com.foo.* and com.bar.* (ProGuard)?

帅比萌擦擦* 提交于 2019-12-02 20:12:58
I want to obfuscate only some packages: com.foo.* com.bar.* I have tried -keepclasseswithmembers class **, !com.foo.**, !com.bar.** { *; } and -keepclasseswithmembers class !com.foo.** { *; } -keepclasseswithmembers class !com.bar.** { *; } In both cases the classes from com.foo.* and com.bar.* was NOT obfuscated. This should work -keep class !com.foo.**,!com.bar.** { *; } You can find a summary of the various -keep options at http://proguard.sourceforge.net/manual/usage.html#keepoverview You can find the explanation of ProGuard's regular expressions at http://proguard.sourceforge.net/manual

How to use Java annotations to guide Android's Proguard?

别等时光非礼了梦想. 提交于 2019-12-02 19:36:11
When using Proguard with Android, methods that are only invoked via reflection (e.g., callbacks defined in onClick XML attributes) are erroneously stripped out. One solution for this issue is to add each affected class and method to your proguard.cfg. How can I use Java annotations to achieve the same effect? I feel that would make the code self-documenting and it would avoid code and proguard.cfg drifting out of sync. However, Android's Proguard doesn't seem to ship with the annotations.jar mentioned in its documentation. Eric Lafortune You can retrieve annotations.jar and annotations.pro

ProGuard + Maven with Java 7

假装没事ソ 提交于 2019-12-02 19:13:44
I'm trying to make ProGuard part of our Maven build process. The problem is that the official Maven plugin is using ProGuard 4.3, which doesn't support Java 7. Is there any easy way to make the plugin use Proguard 4.8 instead? I've tried specifying the dependency for the plugin but ProGuard seems to have a new structure for Maven-modules (proguard-base, proguard-parent etc) so the plugin can't use any version >4.4. Here's how my current pom looks: <plugin> <groupId>com.pyx4me</groupId> <artifactId>proguard-maven-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal

Problems with using jackson-json library when using Proguard

筅森魡賤 提交于 2019-12-02 18:45:39
I'm using the jackson-json library in an Android project, and when exporting the app while using Proguard for obfuscation, I get the following errors: Proguard returned with error code 1. See console Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap

Error working with Jackson library post-obfuscation using Proguard

安稳与你 提交于 2019-12-02 17:36:28
after scouring through all sorts of queries related to issues w/ obfuscation using Proguard, I've come to the point where I feel I might be the only one having this particular issue. Hence, the post. I have a fairly standard android app which makes use of JSON-based REST calls to exchange data. I make use of the Jackson library to parse the JSON data. Everything had been working flawlessly, until we decided to incorporate obfuscation for our release builds using Proguard. After sorting out a world of callback related problems, I'm finally stuck with a problem related to the Jackson library.

ClassNotFoundException: Didn't find class on path: DexPathList

我的未来我决定 提交于 2019-12-02 17:30:24
I have a problem since I updated my App on playstore. Since this update, the exception is thrown, but I haven´t changed anything related to this exception. Stacktrace: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.opiatefuchs.onthejobtimerlight/de.opiatefuchs.onthejobtimerlight.OnTheJobTimerActivity}: java.lang.ClassNotFoundException: Didn't find class "de.opiatefuchs.onthejobtimerlight.OnTheJobTimerActivity" on path: DexPathList[[zip file "/data/app/de.opiatefuchs.onthejobtimerlight-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at android.app

android studio 3.1 Warning: The rule `-keep public class *extends java.lang.annotation.Annotation {

时光怂恿深爱的人放手 提交于 2019-12-02 17:25:15
i recently upgraded android studio but im not able to find the source of the following issue reported in android studio 3.1: Warning: The rule `-keep public class *extends java.lang.annotation.Annotation { the warning seems to be cut off perhaps and missing information. but it looks like a proguard issue although i am getting this warning when building debug variant. i checked my proguard files and i dont have a line that matches that exactly. i searched the entire project. any ideas on the root cause ? As mentioned in the question's comments by @arcone1, @Vincent Mattana & confirmed by