I need help with turning off all features and disable everything that Proguard do for all classes but one. One class should be obfuscated (contains security things). Any ideas?
-dontshrink
-dontoptimize
-dontobfuscate
-keep,allowshrinking,allowoptimization,allowobfuscation class org.mypackage.MyClass
Use this Line into the proguard
Enter all package name for disable things of proguard
-dontwarn your_package_name.**
Related
I saw a lot of warnings when connected, more than 5 thousand, I found information that I should solve problems in a similar way
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
But I have too many classes, I do not believe what I need to add all this one by one, it will take a lot of time and nerves
What are possible solutions? Maybe it can be simplified
I have more than 5 thousand such warnings
1>PROGUARD : warning : com.google.android.gms.internal.zzal: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase
1>PROGUARD : warning : android.arch.core.internal.FastSafeIterableMap: can't find referenced class android.support.annotation.RestrictTo$Scope
1>PROGUARD : warning : android.arch.lifecycle.ClassesInfoCache: can't find referenced class android.support.annotation.Nullable
You have to manually fix all warnings, by applying proguard rules.
Your program code contains copies or better versions of Android runtime classes in the package com.google.android.gms If that's ok:
-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms.**
And so on...
ProGuard manual > Troubleshooting
I am working on an app that someone else wrote and i am trying to only obfuscate the classes that I added. I've seen this post: With ProGuard, how do I obfuscate just one class?
I tried my luck with that (I added a single class and configured ProGuard as shown in the above post) and had only partial success.
It seems like ProGuard is still touching all the other files (md5 hashes change).
This is my ProGuard config:
-dontshrink
-dontoptimize
-dontpreverify
-dontnote
-dontwarn
-target 1.8
-keep class !com.example.Test { *; }
You should also try keeping all the other packages, like:
-keep class com.my.example.** { *; }
When you use a rule containing an exclusion pattern like that:
-keep class !com.example.Test { *; }
it will internally be treated like this:
-keep class !com.example.Test,** { *; }
The ** at the end is implicit and doesn't have to be added. Basically you are trying to say "keep all classes except com.example.Test" (and their methods/fields of course).
I have a Java application running on PC (Windows).
I use Netbeans.
I use Proguard to obfuscate the code and I configure the obfuscation by the build_common.xml (Ant) file; therefore the ProGuard configuration options are given by XML configuration tags.
I'm not expert at all of Xml, Proguard, I just copied and adapted some pieces of codes got in the web for my purposes and it worked.
Recently I introduced in my code ORMLite. When I run from IDE (so without obfuscation) my code works, but when I build with obfuscation it doesn't work.
Inside build_common.xml I excluded the "class com.j256.**" library, by:
<keep name="com.**" > <method name="*" /> <field name="*" /> </keep>
but it isn't enought because probably ORMLite uses special annotations.
I found out some post, suggesting to use for example:
-keepattributes *DatabaseField*
-keepattributes *DatabaseTable*
-keepattributes *SerializedName*
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
-dontwarn com.j256.ormlite.logger.**
-dontwarn com.j256.ormlite.misc.**
but I don't know how to write those options in XML; I did some trying but it didn't work.
Can anybody help? Moreover on how to exclude from obfuscation ORMLite annotations.
Founded out the solution:
simply added inside the proguard tags of 'build_common.xml' file the line:
-keepattributes *Annotation*
`the rest of the lines mensioned in my question seems unusefull
I want to use ProGuard for my android app, but I have some trouble with it. When I build an unsigned apk via android tools (in eclipse) I got following errors:
Warning: com.millennialmedia.android.NVASpeechKit$7: can't find referenced class com.nuance.nmdp.speechkit.Recognizer
[...] //more warnings of the same type as above
You should check if you need to specify additional program jars.
Warning: there were 170 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
I'm using 5 jar files within my app, which are all located in the libs-folder and are added to the build-path (So they propably appear in 'Referenced Libraries' as well as 'Android Private Libraries' again). Additionally, I put a so-library in libs/armeabi...
My proguard - file look pretty normal, yet:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontpreverify
-dontskipnonpubliclibraryclasses
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** e(...);
}
What should I do to fix this error?
regards
PS: I know that proguard can delete/change some important things (like class-files,..). So, will I notice such 'errors' by exceptions immediately when starting my app or do I have to check every detail and navigate to any part of my app at runtime to make sure that it runs as it should?
EDIT:
I'm using following jars:
alljoyn.jar (there's also a path varibale in linked resources to the alljoyn-sdk)
peergroupmanager.jar
android-support-v4.jar
MMSDK.jar
GoogleAdMobAdsSdk-6.4.1.jar
From http://docs.millennialmedia.com/android-SDK/AndroidFAQ.html
I am using ProGuard with my Android application, what should I do to ensure my Millennial ads still work?
To make sure you still receive ads while using ProGuard, add the following snippet to your proguard.cfg file.
-keepclassmembers class com.millennialmedia.android.* {
public *;
}
-keep class com.millennialmedia.android.**
When using ProGuard and not SpeechKit, add the following line to their proguard-project.txt:
-dontwarn com.millennialmedia.android.NVASpeechKit*
I'm trying to obfuscate my Android app. After obfuscating, there are a few things broken, so I need to keep all classmembernames inside a special namespace.
what did't worked was
-keepclassmembers class my.namespace.to.keep** {*;}
any suggestion? It is no Problem if the whole class is kept or only its members.
You don't tell in what way it didn't work, but you may need to specify -keep instead of -keepclassmembers.
You can specify -printseeds to see which classes and class members are matched by the -keep options.