Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unfortunately app has stopped in Android Emulator

I am new to Android and I am trying a few small apps (like Compass). When I run the app in the emulator, it gives the message Unfortunately, Compass has Stopped.

I have no compile time errors.

How do I solve this, and what is causing this?

Thanks in advance.

like image 979
AnoojNair Avatar asked Nov 28 '11 19:11

AnoojNair


People also ask

Why my Android app is unfortunately has stopped?

To clear cache, go to Settings > Application > Manage apps > Select "All" tabs, select the app which was producing error and then tap Clear cache and data. Clearing RAM is a good deal when you are facing the error "Unfortunately, the app has stopped" in Android.

Why is my app not running on emulator Android studio?

The Best Answer is Probably the project you are running is not compatible (API version/Hardware requirements) with the emulator settings. Check in your build. gradle file if the targetSDK and minimumSdk version is lower or equal to the sdk version of your Emulator.


1 Answers

I had the same error message and found that, in commenting out uses-permission nodes in AndroidManifest.xml I had commented out one that was needed. When I put it back in the app ran fine. I was able to reproduce the error. I needed:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

This was for a barebones index.html, single page app, that displays Hello World. And the permission above was the only one I needed to do Run As/ Android Application and get it to run in an emulator.

HTH

like image 83
pdschuller Avatar answered Sep 30 '22 19:09

pdschuller