Is it possible to debug an obfuscated Android app? - android

Suppose I have the code and the mapping of the obfuscated app. Can I somehow debug this app within Eclipse?

In Eclipse, Proguard obfuscation is activated only when the app is exported, aka Release Mode.
Debug information are not added in this configuration, as far as I know.
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. Building in debug mode
does not invoke ProGuard, because it makes debugging more cumbersome.
Source
Edit:
It looks some like hackish solutions exist.
Here are two discussions that may help you:
Issue 14469: Optional ability to run proguard on debug builds when using Eclipse ADT
Issue 34019: Allow proguard stripping in debug builds from ADT

Yes you can. Proguard simply makes it difficult to make sense of it by obfuscating the code.

Related

Android APK crashes on run in release mode, but not in debug mode

I have an application that I built in Android Studio. It used to run just fine and has been released to the store in the past, but for some reason the Release APK won't run when installed. The debug runs fine run via phone or emulator. The debug and release builds both use the same keystore file.
Release mode, the APK crashes immediately on open. I suspect it is a keystore issue, but can't be positive??? Does debug bypass using my keystore even though I have it set?
Anything else that I could possibly try?
NOTE: I have another flavor that uses a different keystore and that one works fine.
As requested here as answer :)
Connect the phone to the pc via USB, have android studio open, go to Android Monitor, select your device and look at logcat. I am pretty sure, the exception is there, just waiting for someone to read it. Android Studio logcat logs even store apk's. so publish the release to your phone and just connect it
Thank you, #Adam
Have you used proguard?
If yes I am dam sure its your proguard issue. I would suggest you please read proguard guideline before using it.
It's not proguard. I spent almost two months with this issue of debug build working while release build doesn't work and messed with the proguard files countless times. The problem was instant run. After removing all references to instant run, it finally worked.
You may be able to get additional information by enabling the debugger during release mode. Take a look at this SO thread: Enable LogCat on Release Build in Android Studio. That way you'll be able to see a traceback of the error that's being thrown.
In my case, while opening the release APK the app was crashing. The best way is to see the logcat for knowing the cause of Error. If you have not written any Proguard rules then just goto your build.gradle and change your "minifyEnabled false". This is because ProGuard is obfuscating your APK to make it harder for hackers to reverse-engineering your APK. If you think obfuscation is not needed, change this in your Gradle configuration.just look here.

Difference between debug and release apks

I am new to android as well as android studio.
From my experience in visual studio, when we test the .exe in another machine we copy the release folder and .exe.
But in android studio I am seeing my colleagues test the debug apk by copying and deploying in other systems using USB drive. seems working also.
May I know what is the consequence of deploying that version? Is the release version relevant only for a play store purpose?
What is the technical difference/consequence other than that debug version contains debug information which may makes it slow or bulky?
Major differences are the debug flag and the signing keys:
For debug builds the apk will be signed with the default debug signing keys with debug flag enabled.
For release keys you will have to explicitly specify the keys to sign with and the debug flag will be turned off so that it cannot be debugged.
Proguard can be turned on for release builds. (also for debug builds but not advised). This step needs to be done explicitly and is false by default.
Note: these things can be altered in your build.config and you can choose what ever permutation and combination you wish.
One important difference is that release APKs typically have had ProGuard (code shrinking) run on them, which detects and removes unused code to reduce the APK size.
From Shrink Your Code and Resources:
Be aware that code shrinking slows down the build time, so you should avoid using it on your debug build if possible. However, it's important that you do enable code shrinking on your final APK used for testing, because it might introduce bugs if you do not sufficiently customize which code to keep.
Your colleagues are probably testing on the debug build type to save time, because it can take significantly longer to build the release APK as opposed to the debug APK.
The all above answers are correct BUT the major difference is that if we use the debug.apk to install the app on the device/emulator we can
*Debug it with debuuger
*Profile the cpu, memory, network with android studio profiler
*See the logs in the logcat
*Debug the layout with layout inspector
if use release.apk we can't use the above features, and we configure some features/libraries to work in specific out put type (Like we can use leakCanary only in debug apk)
The primary difference (if specified otherwise in the build.gradle) between a debug build and a release build is the key with which they are signed. Most app distribution channels would [only] want an app signed with a release key to authenticate the developer. Otherwise, there are no differences.
A release build may also trigger other options like code obfuscation and splits so, look out for these.
However, there are many changes that can be brought about in between these two versions. These should be specified in your build.gradle, if any. So, you should keep an eye there.

What is the difference between a debugged version android apk and a release non-debugged version android apk?

What are some notable differences that a developer should take note?
The first one is debuggable and the second one isn't.
That means that the first one will output all your Log.d's and the production version won't.
Also, by default, debug versions are compiled without ProGuard while production builds are compiled using the default ProGuard rules
you may take a look at those posts
Android Studio: Build type release /debug - what relevance does this have?
also the officiel documentation is clear and hepful
http://developer.android.com/tools/publishing/app-signing.html
hint
debug when you are working on the project
release when you are about to publish the app
good luck !
One of the most important differences is that debug version of app is not prguarded so it can be reverse engineered. The reason why it's not proguarded is because you can track your logcat outputs easily without need to check mapping files.
In debug mode, you sign your app with a debug certificate generated by the Android SDK tools. This certificate has a private key with a known password, so you can run and debug your app without typing the password every time you make a change to your project.

Pro Guard for a basic application : android

I have made my first application for android. It does nothing much just stores some user specified data in SQLiteDatabase and manages it. Now, the app requires no special permission. And while reading the guidelines for publishing it, I came across Pro-Guard. On researching it and reading the developer page on it, I am not able to understand that do I also for a basic app need to set up this pro guard file. I already have a proguard-project.txt in my application folder. It does not have a code, but normal English sentences. What should I do ?
In the project.properties file you can enable Proguard by uncommenting the line that says proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt.
Note:
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. Building in debug mode does not invoke ProGuard, because it makes debugging more cumbersome.
This is the documentation.

Android Instrumentation Test concerns: debug vs. release mode

To automate tests, we are considering the Android instrumentation tests. However, we are concerning the performance may differ significantly if the unit tests are put in the debug mode. After doing some search, there seems no definitive answers. Thus, we need some clarifications about the following points.
Does Eclipse/ADT compile the project using the same compiler optimization options whether it is in debug or release mode?
the apk generated by Eclipse/ADT is always in debug mode (whatever "run as" or "debug as"). The suggested way to build the release version is through the export wizard. The only difference is the attribute "android:debuggable='true'" in the resulting AndroidManifest.xml. Without proguard enabled, the resulting size seems the same. Assuming no compiler optimization, does this attribute cause or change the JIT optimization at run-time significantly?
We use the debug key to sign the apk and it seems to work. Is the resulting apk truly a release version (We think so because "android:debuggable="true" is removed)?
Thanks.
1) Yes and no, even though the optimization is the same, the application will run slower as it will have lots of subproceses monitoring it.
2) AFAIK it isn't significative but it will affect the performance of your app.
3) It will work but it's not recommended, you should try reading the SDK here
http://developer.android.com/tools/publishing/app-signing.html

Categories

Resources