Why my android app crashes with “Unfortunately myapp stopped” error?

ndutgd4

New Member
I am still learning the android apps development and after I started making a very simple app with google maps api v2 (not using it yet) when i run it on my Sony Xperia SL it says "Unfortunately myapp stopped". The red msg's in the LogCat are "Can't open file for reading" (twice).MainMenu.java\[code\]public class MainMenu extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_menu); Button bntStart = (Button) findViewById(R.id.buttonStart);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(1, menu); return true;}}\[/code\]MainActivity.java\[code\]public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true;}}\[/code\]activity_main_menu.xml\[code\]<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/menu_bg"android:gravity="center_vertical"android:orientation="vertical" ><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" > <Button android:id="@+id/buttonStart" android:layout_width="80dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="5dp" android:text="Start" /> <Button android:id="@+id/buttonStop" android:layout_width="80dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="5dp" android:text="Stop" /></LinearLayout><Button android:id="@+id/buttonExit" android:layout_width="80dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="5dp" android:text="Exit" /></LinearLayout>\[/code\]activity_main.xml\[code\]<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity" ><fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /></RelativeLayout>\[/code\]manifest\[code\]<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="taxi.route"android:versionCode="1"android:versionName="1.0" ><uses-sdk android:minSdkVersion="11" android:targetSdkVersion="16" /><permission android:name="taxi.route.permission.MAPS_RECEIVE" android:protectionLevel="signature" /><uses-permission android:name="taxi.route.permission.MAPS_RECEIVE" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /><uses-feature android:glEsVersion="0x00020000" android:required="true" /><application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="taxi.route.MainMenu" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="http://stackoverflow.com/questions/14425726/AIzaSyCwPOMQ3LaE81JN3wdY6DvUi7EIJdn0q-I" /> <activity android:name="taxi.route.MainActivity" android:label="activity_main" > </activity></application></manifest>\[/code\]stack trace (i am not sure if thats the thingy)\[code\]01-20 17:48:32.129: D/dalvikvm(663): Late-enabling CheckJNI01-20 17:48:32.399: D/TextLayoutCache(663): Using debug level: 0 - Debug Enabled: 001-20 17:48:32.459: D/libEGL(663): loaded /system/lib/egl/libGLES_android.so01-20 17:48:32.469: D/libEGL(663): loaded /system/lib/egl/libEGL_adreno200.so01-20 17:48:32.469: D/libEGL(663): loaded /system/lib/egl/libGLESv1_CM_adreno200.so01-20 17:48:32.469: D/libEGL(663): loaded /system/lib/egl/libGLESv2_adreno200.so01-20 17:48:32.509: I/Adreno200-EGLSUB(663): <ConfigWindowMatch:2078>: Format RGBA_8888.01-20 17:48:32.519: D/memalloc(663): /dev/pmem: Mapped buffer base:0x5c67c000 size:27111424 offset:23343104 fd:6401-20 17:48:32.519: E/(663): Can't open file for reading01-20 17:48:32.519: E/(663): Can't open file for reading01-20 17:48:32.529: D/OpenGLRenderer(663): Enabling debug mode 001-20 17:48:32.529: W/ResourceType(663): No package identifier when getting value for resource number 0x0000000101-20 17:48:32.529: D/AndroidRuntime(663): Shutting down VM01-20 17:48:32.529: W/dalvikvm(663): threadid=1: thread exiting with uncaught exception (group=0x40aa8210)01-20 17:48:32.529: E/AndroidRuntime(663): FATAL EXCEPTION: main01-20 17:48:32.529: E/AndroidRuntime(663): android.content.res.Resources$NotFoundException: Resource ID #0x101-20 17:48:32.529: E/AndroidRuntime(663): at android.content.res.Resources.getValue(Resources.java:1023)01-20 17:48:32.529: E/AndroidRuntime(663): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2110)01-20 17:48:32.529: E/AndroidRuntime(663): at android.content.res.Resources.getLayout(Resources.java:862)01-20 17:48:32.529: E/AndroidRuntime(663): at android.view.MenuInflater.inflate(MenuInflater.java:92)01-20 17:48:32.529: E/AndroidRuntime(663): at taxi.route.MainMenu.onCreateOptionsMenu(MainMenu.java:21)01-20 17:48:32.529: E/AndroidRuntime(663): at android.app.Activity.onCreatePanelMenu(Activity.java:2444)01-20 17:48:32.529: E/AndroidRuntime(663): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:392)01-20 17:48:32.529: E/AndroidRuntime(663): at com.android.internal.policy.impl.PhoneWindow.invalidatePanelMenu(PhoneWindow.java:743)01-20 17:48:32.529: E/AndroidRuntime(663): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:2838)01-20 17:48:32.529: E/AndroidRuntime(663): at android.os.Handler.handleCallback(Handler.java:605)01-20 17:48:32.529: E/AndroidRuntime(663): at android.os.Handler.dispatchMessage(Handler.java:92)01-20 17:48:32.529: E/AndroidRuntime(663): at android.os.Looper.loop(Looper.java:137)01-20 17:48:32.529: E/AndroidRuntime(663): at android.app.ActivityThread.main(ActivityThread.java:4441)01-20 17:48:32.529: E/AndroidRuntime(663): at java.lang.reflect.Method.invokeNative(Native Method)01-20 17:48:32.529: E/AndroidRuntime(663): at java.lang.reflect.Method.invoke(Method.java:511)01-20 17:48:32.529: E/AndroidRuntime(663): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)01-20 17:48:32.529: E/AndroidRuntime(663): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)01-20 17:48:32.529: E/AndroidRuntime(663): at dalvik.system.NativeStart.main(Native Method)01-20 17:48:35.009: I/Process(663): Sending signal. PID: 663 SIG: 9\[/code\]
 
Back
Top