3

I have finished developing an Android app. I'm using android studio. Everything is working fine when I normally run the app in debug mode on my device. Not even an exception.
But when I followed Google's guidelines on creating the signed release version of my app and installed it in my device, the app is force closing as soon as I launch it.
I just can't figure out a way to locate what the problem is. I created the release version using the "Generate signed apk" option in the Android studio IDE. Then I copied it in my device and installed the app. And then when I run, it just stops working immediately.

I don't know what more info should I give here because I just can't infer the cause of this issue.

Please help. What can be the possible reasons behind such problems.? And how can I find them?

EDIT:
Everytime I unlock the device, it is displaying the dialog "MyApp has stopped working". There's nothing in the logcat. I have no idea why this might be happening. My app uses these permissions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission
        android:name="com.mypackagename.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.mypackagename.permission.C2D_MESSAGE" />  
Anjani
  • 1,533
  • 3
  • 15
  • 26
  • 2
    please provide the crash log – Gennadii Saprykin Jul 15 '15 at 16:38
  • 2
    Use LogCat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Jul 15 '15 at 16:54
  • how do I see the logcat for the release version. As I said, I'm installing the app by manually copying it in the device and then installing it from there. Even then, I tried to use the Android studio's logcat but there's nothing showing up there. That's the main problem! – Anjani Jul 15 '15 at 17:06
  • 1
    @CommonsWare has provided a link showing various ways of viewing the device console logs. The log output doesn't differentiate between debug and release builds of your app, that makes no difference – CSmith Jul 15 '15 at 18:55
  • Well, I still couldn't see anything in logcat. But I solved the problem. I used a tool in android sdk called "monitor". It shows everything that happens on your device. I found out that the problem occured because I forgot to add a few lines in the proguard file related to third-party libraries. Now I'm back on track. Thanks. – Anjani Jul 15 '15 at 19:19

1 Answers1

5

I solved the issue on my own.

First of all, you can use a tool named "monitor", present in the android sdk tools to debug your release version. This tool shows everything that happens in your device.

I used the tool and found out that the problem occurred because I had enabled proguard in my app and forgot to add rules for third party libraries used in my app.

So all those who might be facing this problem, check your proguard file and make sure you've added the required rules for all third party libraries as well.

Anjani
  • 1,533
  • 3
  • 15
  • 26