Wednesday, September 4, 2019

Unfortunately, “App Name” has stopped. (Eclipse, Android)

I am somewhat new to Android app Programming.
I was able to create the app and be able to export it and install it to my android device, but when I try to run it it quits and displays the message "Unfortunately, My First App has stopped." This problem is also present when I try to run the app in an emulator



This is my AndroidManifest file:





package="com.example.tada"
android:versionCode="1"
android:versionName="1.0" >

android:minSdkVersion="12"
android:targetSdkVersion="21" />


android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:name=".MainActivity"
android:label="@string/app_name" >














This is my mainactivity file:



package com.example.tada;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;



public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}


@Override

public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
item.getItemId();
return true;

}
}


This is my activity_main file



xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.tada.MainActivity" >

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/welcome_to_the_tada_app" />





Here is my LogCat



11-23 01:22:21.520: D/AndroidRuntime(1055): Shutting down VM
11-23 01:22:21.520: W/dalvikvm(1055): threadid=1: thread exiting with uncaught exception (group=0xb3afbba8)
11-23 01:22:21.560: E/AndroidRuntime(1055): FATAL EXCEPTION: main
11-23 01:22:21.560: E/AndroidRuntime(1055): Process: com.example.tada, PID: 1055

11-23 01:22:21.560: E/AndroidRuntime(1055): java.lang.Error: Unresolved compilation problem:
11-23 01:22:21.560: E/AndroidRuntime(1055): activity_main cannot be resolved or is not a field
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.example.tada.MainActivity.onCreate(MainActivity.java:14)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.Activity.performCreate(Activity.java:5231)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.os.Handler.dispatchMessage(Handler.java:102)

11-23 01:22:21.560: E/AndroidRuntime(1055): at android.os.Looper.loop(Looper.java:136)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-23 01:22:21.560: E/AndroidRuntime(1055): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 01:22:21.560: E/AndroidRuntime(1055): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-23 01:22:21.560: E/AndroidRuntime(1055): at dalvik.system.NativeStart.main(Native Method)
11-23 01:22:26.100: I/Process(1055): Sending signal. PID: 1055 SIG: 9

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...