android studio - proguard.cfg file is missing - android

I want to minimize the size of .apk file, so I follow the Android Developer guide (http://developer.android.com/tools/help/proguard.html), but there are some problems I encountered as follows:
I create a new project via Android Studio, but it doesn't generate a proguard.cfg file. And there exists a local. Properties file rather than project. Properties file.
How can I figure out this issue?

In the new version of the ADT, the file generated is not proguard.cfg but proguard-project.txt. Proguard must be activated in the file project.properties.
You can check this link: http://tools.android.com/recent/proguardimprovements

Related

How to find 'proguard.cfg' file [duplicate]

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 directory of your project.
To enable Proguard, you will need to ignore the "do not modify" warning in project.properties and uncomment the following line:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
The Android toolchain will sometimes make changes to project.properties, but your Proguard path will be preserved.
In my case, the entire Proguard folder was missing at the location specified in the error. Make sure that the folder is present.

Where is proguard-rules.txt in android studio?

In my demo project, proguard-rules.txt is not available in Android studio.
I must be missing some code :
Where can I find proguard-rules.txt file?
I want to add proguard rules
Any help is appriciated
Thank you
Looks like your project is missing proguard files. You can add it yourself: put the proguard-rules.txt file into the app directory. It's already added to your build.gradle file so no further actions required.
proguard-rules.txt (or proguard-android.txt) are in your SDK folder, but if you want to add something to your ProGuard rules you should do this in proguard-rules.pro.
This file should be automatically added to your project by Android Studio when you create new (if isn't present - create manually). Check DOC (Gradle section ofc)
it is located under your sdk folder, usually in yoursdk/tools/proguard/. If you are using linux or mac, once you cd into the sdk folder you can run
find . -iname proguard-rules.txt
to look for it
You can manually create the file in the \StudioProjects\your_project\app folder and you can add the custom rules.

How to obfuscate Android library project with Eclipse?

Hi I developed one small library in Java for my Android application. I want to do obfuscating for that library. I using Android version 4.1.2. First thing is that according to Google's Android documentation there is no proguard.cfg file in my project root directory. Instead of that proguard-project.txt is there. I add proguard.config=proguard-project.txt into my project-properties file.
After this configuration I tried to export this library project and try to do obfuscating of that project. It showing error can generate .apk file because it is library project.
Then I tried with another option in export. Instead of regular export android application I use general -> archive file and tried to export it and generate jar file but I check inside the jar and no encoding is done. That means anyone can extract and check classes and content inside my library. But the main thing is that it generates proguard folder inside my project and also generate dump mapping seeds usage.text files inside it.
So I need help to do proper ProGuard obfuscating of my Android library. Am I doing something wrong. What kind of configuration do I have to add inside my proguard-project.txt so that it will do proper encoding of my code?
Actually, you can obfuscate a library project, but not directly! You can only do that by exporting the entire application's project that uses that library.
With that in mind, you can set a different proguard.cfg at the root folder of your Library Project.
Hope this helps.

proguard.cfg file missing

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 directory of your project.
To enable Proguard, you will need to ignore the "do not modify" warning in project.properties and uncomment the following line:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
The Android toolchain will sometimes make changes to project.properties, but your Proguard path will be preserved.
In my case, the entire Proguard folder was missing at the location specified in the error. Make sure that the folder is present.

Proguard folder empty

I am using Eclipse to build my Android Application. When I export the project as an Android Application I can use my keystore and key to sign the apk just fine. Before exporting I also added the Proguard config location to the properties file, I also changed my Android SDK file path to one without spaces, and I have debuggable set to false in my manifest.
With all of those done, the proguard folder in my project that is created does not contain any files and the Android documentation claims it will contain several.
http://developer.android.com/guide/developing/tools/proguard.html
What have I missed?
Stupid error on my part. It looked like it was succeeding because it was. Its just the proguard files weren't imported into eclipse so they didn't show up in package explorer. Manually entering workspace I found them.
That is indeed a little embarrassing. Oh well.

Categories

Resources