Android proguard crashes after enabling google analytics - android

I activated google analytics for my android application, when I tried to use proguard I got this errors.
What is the solution?

It means that class is obfuscated by proguard.
Personally I always add the generic rule
-keep class com.google.** { *; }
in my proguard because I only care for obfuscation of my own code. That should fix your error. But if you just want to add that class only it should also work I guess.

Related

Fabric Crashlytics reports display some letters instead of classes names of my Android App

In Fabric Crashlytics reports I see some letters instead of classes names. for example when I see "MainActivity" I understand that a crash occured in MainActivity.java, but now I see letter "a" , "e" or "w" instead of class name and I can't understand in which class that crash occured!
How can I solve this problem?
Possibly you're using proguard or dexguard to obfuscate your code, hence when crashlytics reports it, it reports it with symbols instead of actual method and class names.
if you wish to use proguard with crashlytics, follow this doc here to add the necessary proguard rules or simple exclude proguard on crashlytics by adding the following to your proguard-rules file:
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
would recommend adding all the rules mentioned there for better stability.
if you do not know what proguard is or wish not to use it, go to your build.gradle file for app and change the line to:
minifyEnabled false
Happy coding!
You must upload your mapping file for your obfuscatated code. In that way the stack trace will be de obfiscated. This is the official documentation

Proguard configuration for sqlite android bindings

I am trying to use SQLite android bindings to have a custom encrypted SQLite DB in my android app. It all works fine and I am about to publish my app. I am trying to use ProGuard for code obfuscation and compression but does not seem to work fine with SQLite android bindings. My released app crashes on startup because it cannot find few .so files used by SQLite. I am not sure what should be the correct ProGuard rule to keep those libraries.
Right now I have added only this to my ProGuard:
-keep class org.sqlite.**
Usually,
-keep class org.sqlite.** { *; }
-keep class org.sqlite.database.** { *; }
would do the trick.
Verify your mapping.txt for what ProGuard is already done, and make sure that your models are not got renamed. If so, you may need
-keep class com.your.modelspackage.**
-keepclassmembers com.your.modelspackage.** { *; }
Hope it helps

Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU

I started getting the message with the latest Android Build Tools (ABT) v19.0.3 today. At first glance, I thought this might be an issue with ABT. However, a closer investigation reveals that this message:
android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
is only shown when Proguard is used. Answers on the net has yeilded no solution for me. Perhaps, this is only an issue with Proguard (the version I'm using is bundled with Android SDK v22.3).
I have added the following directives to proguard-project.txt file, but it makes no difference:
-keep interface android.support.v4.** { *; }
-keep class android.support.v4.** { *; }
Does anyone else come across this message and has a possible solution? Maybe Eric from Proguard might be able to shed some light into this issue. Maybe a code cleanup is required with Proguard? I'm interested to know the solution.
The note says that a support class is using reflection to access a runtime class that isn't present in the target runtime. In general, it could be a sign of compatibility problems. In this case, it's harmless; the developers of the support library are precisely using reflection to avoid any linking problems with different runtime environments. You can suppress the note with:
-dontnote android.support.**

Including external libraries in Android Proguard

My app is able to run without any issues during testing etc. But when I export out apk compiled with ProGuard, there are issues like random crashing and some features not working as expected.
I not sure is it due to the external jar libraries I have included in the project which is not properly configured in Proguard.
I have included the following in the proguard-android.txt file. I have two libraries so I added these:
-keep class org.apache.commons.net.** { *; }
-keep class org.jsoup.** { *; }
Is it the correct way? Is there any other way?
To add libraries just add -libraryjars ../libs/<libname>
After that you may need to keep classes and interfaces based on the errors you receive

Proguard config for newrelic in android app?

I'm not using new relic in my app and it still shows class not found error.
Only solution that worked for me is to include new relic. I'm using eclipse.
App works in debug, now I want to use proguard and I'm new to it.
What do I need to write in proguard-project.txt to include newrelic in proguard.
Thanks!
After some testing and researching, to launch an Android app with NewRelic and have ProGuard enabled, just copy and paste the following snippet in your proguard.cfg file (or if you have yours specified as proguard-properties.txt):
-keep class com.newrelic.** { *; }
-dontwarn com.newrelic.**
-keepattributes Exceptions, Signature, InnerClasses
Source
You'll need to add the following -keep code to your proguard.cfg file (or if you have yours specified as proguard-properties.txt):
-keep public class com.newrelic.** {
public *;
private *;}
Install the agent and add that code snippet to your progaurd.cfg file.
As for the issue with non-New Relic apps throwing errors when New Relic is installed, this seems to be an issue with the build path settings in Eclipse, you can open a support ticket with us at support#newrelic.com and we can take a look at your specific environment settings, but prior cases indicate that this isn't really a New Relic-specific error.

Categories

Resources