proguard

How can I tell proguard to assume a package is not used?

久未见 提交于 2019-12-04 07:28:59
I'm attempting to set up proguard for my Android project. We use some pieces of a netty library in our code and I'd like to use Proguard to completely remove the pieces of code that I know aren't used. Is there some way to tell proguard to assume a package (or class) is never used and so should not be included in the output JARs? Note that I'm not talking about excluding some code from obfuscation (which is what the -keep configuration options do), I'm talking about completely removing a class from the output. Edit : As suggested by pst below, I tried to use the -whyareyoukeeping argument to

Android apk Debug mode works fine but release mode gives too many warnings

[亡魂溺海] 提交于 2019-12-04 07:27:58
I'm trying to get a signed APK from eclipse. I have a debuggable apk version that works fine. Now for release when I tried to compile and sign with Eclipse ADT, I get many warnings, most of which is can't find superclass or interface some.package.Class . So, I referred to this , this and many others unfortunately I couldn't reach anywhere! I also get Note: there were 314 duplicate class definitions. warning My progaurd-project.txt was untouched earlier. So, I added -libraryjars /libs/lib-name for each of the jars present at /EcliseProject/libs/ folder. So I came up with the following:

Always running proguard before Android dex'ing in Eclipse

孤街浪徒 提交于 2019-12-04 06:56:27
Is there a way to make Eclipse always run proguard before dex'ing when trying to run an Android Application? e.g. some way of seamlessly inserting it as a build step? By default it will run when exporting, but I need it to always run, even when e.g. just doing a normal "Run" or "Debug" from the menu / keyboard. For context, the reason this is relevant is that I'm running into the "too many opcodes / no expanded opcodes" (http://code.google.com/p/android/issues/detail?id=26203) issues with my build in Eclipse. It's not an issue for ant builds because they run proguard, which strips all of the

how to specify injars for proguard within android gradle build files for libraries that are pulled from maven central

眉间皱痕 提交于 2019-12-04 06:47:10
is there a way to pass libraries pulled from maven central as injars for proguard? I want them to be obfuscated. Context: remove unused classes with proguard for Android I never used Maven and I'm using Gradle, but either build syste, the same thing applies I believe. And I don't think that what you want is possible... The -injars keyword is specific to the ProGuard configuration file, which is a text file read by the build tools. The only way I see is that if you build some kind of script that will that for you. That is, read all Maven dependencies, create the appropriate ProGuard

Proguard error if i use itext Library jar

落爺英雄遲暮 提交于 2019-12-04 06:37:46
Proguard won't work with iText library. the errors are related to org.spongycastle.** org.bouncycastle.* and com.itext.pdf.** I have tried to use keep on these packages without success. My proguard config file is this: -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 5 -allowaccessmodification -dontpreverify -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose -keepattributes *Annotation* -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing

Obfuscate Parcelable classes with proguard

隐身守侯 提交于 2019-12-04 05:54:27
I'm trying to obfuscate a parcelable class with Proguard: Before adding the Parcelable part the class is: public class Foo{ private String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } } The obfuscated result is: public class a { private String a; public String a() { return this.a; } public void a(String paramString) { this.a = paramString; } } After adding implementing parcelable the example class is public class Foo implements Parcelable { private String value; private Foo(Parcel in) { value = in.readString(); } public Foo() { }

My log messages are not removed with proguard configuration

烂漫一生 提交于 2019-12-04 05:33:19
I am developing my Android app. Then I enable & configure proguard by: Step 1. Enable proguard: In project.properties I have: proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt I also tried the following: # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=proguard.cfg Step 2. Configure proguard: In proguard.cfg I have: -assumenosideeffects class android.util.Log { *; } I think the above configuration should remove all logs. But when I install the APK under target/ folder &

Google Play Services with Proguard in Android Studio

坚强是说给别人听的谎言 提交于 2019-12-04 05:32:32
I've recently move across from Eclipse to Android Studios. I had my app using Proguard via eclipse and now that I've move across I'm getting the following errors. Error: ProGuard: [myApp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced field 'int auth_client_availability_notification_title' in class com.google.android.gms.R$string ProGuard: [myApp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced field 'int auth_client_play_services_err_notification_msg' in class com.google.android.gms.R$string ProGuard: [myApp] Warning: com.google.android

Keeping java methods called from Android JNI

巧了我就是萌 提交于 2019-12-04 05:09:47
I'm trying to obfuscate an Android app code via Proguard. After processing with proguard the app is working by itself, however native calls made from c to java are failing with java.lang.NoSuchMethodError . This code is from the native part, where a call is made to the java class instance, named EngineStarted: void callEngineStarted( JNIEnv* env, bool isStreamOne ) { jclass cls; if(isStreamOne == true) { cls = ( *env )->GetObjectClass( env, currentObjectOne ); } else { cls = ( *env )->GetObjectClass( env, currentObjectTwo ); } jmethodID midCallBack = ( *env )->GetMethodID( env, cls,

Run Proguard on multi-module project as “one piece”

*爱你&永不变心* 提交于 2019-12-04 04:38:32
TLDR: How to pass proguard mapping to javac to compile against obfuscated library ? That's long, but I don't see how to make it shorter: Background: I have the following product setup: Android Studio project - Library module - (sub)module Core - (sub)module A - (sub)module B - (sub)module C - Sample App module - ... Other modules Each of library submodules A, B, C reference classes in Core, but A, B, C independent among themselves. Conceptually similar to Play Services where user can only have code and required sub-module. Each of the library submodules has external APIs but also many internal