Unfortunately app has stopped in Android Emulator

≯℡__Kan透↙ 提交于 2019-12-09 14:19:58

问题


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.


回答1:


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




回答2:


You have posted no code so it's difficult to see what your problem is. However I had the same issue which has been sorted out here Unfortunately HelloListView has stopped




回答3:


It probably due to the fact that you don't have accelerometer and magnetic field support. Go to your AVD configuration and add the following hardware: Magnetic Field Support and accelerometer




回答4:


First check your AndroidManifest.xml file and write activity tag

For example, you have DisplayMessageActivity.class and package is me.user_interface

tag is:

<activity android:name="me.user_interface.DisplayMessageActivity"/>

You can write this after </activity> tag in AndroidManifest.xml file. Check the path carefully.



来源:https://stackoverflow.com/questions/8300947/unfortunately-app-has-stopped-in-android-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!