androidapksigned-apk

App not working while generating signed apk and installing in real device


I made an app and tested everything. I was working fine in emulators and in USB-connected devices but did not work when generating signed apk file. I have made the app with both disabled/enabled instant run and it still didn't work.

I also tried uninstalling (for all users) and reinstalling the apk, still the issue remained (but application works fine with build apk). I have possibly tried all solutions available in similar posts but I can't find a solution, any help would be much appreciated.


Solution

  • I solved my problem by adding these 2 lines in my proguard-rules.pro file:

    -keep class android.support.v7.widget.SearchView { *; }
    
    -keep class android.support.v7.widget.ShareActionProvider { *; }
    

    I have used search view in my activity, so I needed these library files to work when generating a signed apk. However I don't know why without including these files my app worked perfectly in emulators and in devices with usb debugging and not showing any errors in logcat files - it made it difficult to understand the problem.