2

I am using Firebase crash reporting into my android app. I am using Proguard to obfuscate my app. I have uploaded mapping.txt file generated after building release apk, to the Firebase Crash reporting, but I am still getting some Obfuscated code, mainly code from libraries used into my project as below.

Caused by java.lang.NullPointerException: Attempt to invoke virtual method   
'long com.google.firebase.b.a.a(java.lang.String)' on a null object reference
com.myapp.myodulel.GamePageFragment.onActivityCreated (GamePageFragment.java)
__null__.access$300 (GamePageFragment.java)
android.support.v4.app.Fragment.getActivity (Fragment.java)
__null__.performActivityCreated (Fragment.java)
android.support.v4.app.FragmentManagerImpl.modifiesAlpha     (FragmentManagerImpl.java)

Third party apps functions are not visible properly as "com.google.firebase.b.a.a". Also I am not getting proper line number of errors.

I am using following jars into my project.

compile 'com.google.firebase:firebase-ads:9.8.0'      
compile 'com.google.firebase:firebase-config:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile 'com.google.android.gms:play-services-analytics:9.8.0'
compile 'com.android.support:appcompat-v7:24.1.1'
compile project(path: ':BaseGameUtils')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'

I believe I have not configured proguard properly to use these third party apps. I have seen their documentation, but they have not mentioned what to add and how to add. Please help me as I am new to Proguard.

Edit:

Currently my proguard-rule.pro file has following code other than comments.

-dontwarn com.squareup.okhttp.**

I did some research and I think I need to add -keep flag for third party libraries I am using in my app like firebase and google play service. But will it compromise obfuscation? And will I get line numbers of errors after that? Or I have to do something else?

vijay053
  • 822
  • 3
  • 18
  • 36

1 Answers1

1

Add

-keepattributes SourceFile,LineNumberTable

to your proguard config to see correct line numbers.

F43nd1r
  • 7,690
  • 3
  • 24
  • 62
  • Is their any side effect of keeping this flag into production? – vijay053 Jan 24 '17 at 03:00
  • Yes. Anybody with the source can manually retrace a stacktrace. If you want to prevent that, ceck out the `-renamesourcefileattribute` option – F43nd1r Jan 24 '17 at 12:40
  • And how to solve "com.google.firebase.b.a.a" problem. Is using -keep flag the right solution. If yes, should I add keep flag for all third party libraries I am using in my app? – vijay053 Jan 25 '17 at 09:27
  • 1
    @vijay053 Everything in play services and firebase packages except public API is already proguarded. Keeping the classes will not help you. – Eugen Pechanec Jan 26 '17 at 14:36
  • @EugenPechanec Than what should I do to solve this problem ("com.google.firebase.b.a.a")? – vijay053 Jan 30 '17 at 18:54