proguard

How to tell ProGuard to keep everything in a particular package?

扶醉桌前 提交于 2019-11-27 09:13:52
问题 My application has many activities and uses native library too. With the default ProGuard configuration which Eclipse generates ProGuard removes many things - OnClick methods, static members, callback methods which my native library uses... Is it there a simple way to instruct ProGuard to NOT remove anything from my package? Removing things saves only about 2.5% of the application size, but breaks my application completely. Configuring, testing and maintaining it class by class in ProGuard

How to debug with obfuscated (with ProGuard) applications on Android?

那年仲夏 提交于 2019-11-27 09:12:21
问题 When I got something like this ERROR/AndroidRuntime(18677): Caused by: java.lang.NullPointerException ERROR/AndroidRuntime(18677): at com.companyname.a.a.a(Unknown Source) How can I know where the problem is and debug this issue? I only got the mapping output from ProGuard and don't know the line number. Thanks. 回答1: Add the following lines to your proguard configuration. -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable Now your stack traces will include line

How to configure proguard for javascript interface?

穿精又带淫゛_ 提交于 2019-11-27 08:51:49
I have a implemented a Webview which takes use of JavascriptInterface. It's working fine when not obfuscating, but at once Proguard is active, it does not work. I've looked here at other answers, but i still can't get it working. Some of the WebView class: public class Activity_Webview { private WebView webView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(new JavaScriptInterface (), "HTMLOUT"); webView.setWebViewClient

proguard.cfg file missing

限于喜欢 提交于 2019-11-27 08:50:36
Reading the docs on proguard . . . android docs I'm supposed to have a ProGuard.cfg as it says... "When you create an Android project, a proguard.cfg file is automatically generated in the root directory of the project. " If I google the issue there are answers all over the place most of them saying to modify a file that starts with a warning not to modify the file. Are the docs out of date? How to I get this enabled for release builds? thanks, Gary If you're using ADT 17 or newer , the documentation is slightly inaccurate. The generated file is proguard-project.txt and will be in the root

Turning Proguard On/Off Using Properties

我与影子孤独终老i 提交于 2019-11-27 08:31:23
问题 In my project.properties file there is a property proguard.config and when i run ant it will run proguard. All of the following will cause proguard to run proguard.config proguard.config= proguard.config=proguard.cfg Is there a way within the properties file to turn proguard on/off? Otherwise I am going to need to write a script to add/remove or rename the proguard.config property to control this. I would rather just get/set properties. I want the best solution for this. Right now I am coding

How do you stop Proguard from removing type parameters?

自闭症网瘾萝莉.ら 提交于 2019-11-27 08:14:30
I am currently attempting to obfuscate a series of libraries. My base library, which contains several classes and methods that use type parameters, is unusable by other code due to the type parameters being removed by Proguard obfuscation. Eliminating the obfuscation removes these issues. I have read through all of the ProGuard usage documents, examples, and troubleshooting, but have been unable to find any documentation on how to deal with type parameters or which aspect of ProGuard strips the type parameters. Constructor Type Parameter Issue: Library 1 contains the following class: public

Android Proguard does not inline

馋奶兔 提交于 2019-11-27 07:39:12
问题 I am using the latest Android SDK (4.1) and I tried exporting a signed jar with Proguard enabled. However, after decompiling the optimized APK, I noticed that methods that I would have expected to be inlined were not. I know that Proguard ran because the code was correctly obfuscated. So to confirm this, I added this method to my Activity: private void testInlining() { mConfig = null; } This private method is called only once in my activity, and because it is private, it should be very

How to obfuscate an Android library (.jar file) using Proguard in Eclipse

女生的网名这么多〃 提交于 2019-11-27 07:38:55
I have seen many posts about how to obfuscate an Android application (.apk file) using ProGuard in Eclipse. Also see http://developer.android.com/guide/developing/tools/proguard.html : "When you build your application in release mode, either by running ant release or by using the Export Wizard in Eclipse, the build system automatically checks to see if the proguard.config property is set. If it is, ProGuard automatically processes the application's bytecode before packaging everything into an .apk file ." But in case of exporting an Android project in a .jar file using Eclipse Export Wizard,

Reducing android app (apk) size

家住魔仙堡 提交于 2019-11-27 06:33:46
I would be now publishing my first app on Google play store. I have already compressed images used in my app. And I have some questions regarding the app size. If the size of app is less that 2 MB then there are less chances that user will uninstall the app, is my this statement true for apps belonging to education field ? However, When I see my apk file in windows it shows 3.10 MB but when it gets installed in device as viewed from App info it shows: Total............................8.68 MB App..............................7.02 MB USB storage app..................0.00 B Data..................

Why Proguard keeps Activity class in Android?

孤街醉人 提交于 2019-11-27 06:12:01
问题 I have applied ProGuard to my Android application. I'm using android-studio/sdk/tools/proguard/proguard-android.txt as a configuration file, changing nothing. In this file I can see the only statement regarding Activity : We want to keep methods in Activity that could be used in the XML attribute onClick -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } It follows from that the Activities class names are obfusctated by ProGuard while some methods are