1

Hello StackOverflow community,

Thanks for taking the time to have a look at my question. I have started the basic android tutorial a few days ago, and have been struggling since. The tutorial, as well as this one www.vogella.com/tutorials/Android/article.html, state that the emulator should directly show my app and the welcome text "hello world", but it always shows "unfortunately, AppName has stopped". In the preview of eclipse and android studio the app shows properly. I have not edited the code in the current state, as this is a new project. I have been trying to implement solutions in a similar project, without success.

I read previous answers and agree that my question is very similar. However, I still do not manage to get my project started with the answers given threads including:

Unfortunately app has stopped working

"Unfortunately, app name has stopped." android device or emulator

My Java code is the following:

package com.example.timen.myapplication;

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


public class MyActivity extends Activity {

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


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

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}

Manifest

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MyActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

And the Logcat

1036-1036/com.example.timen.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.timen.myapplication, PID: 1036
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.timen.myapplication/com.example.timen.myapplication.MyActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
        at android.app.ActivityThread.access$800(ActivityThread.java:138)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5026)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
        at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
        at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
        at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
        at android.app.Activity.setContentView(Activity.java:1930)
        at com.example.timen.myapplication.MyActivity.onCreate(MyActivity.java:13)
        at android.app.Activity.performCreate(Activity.java:5242)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
Community
  • 1
  • 1
Tmen
  • 13
  • 3

2 Answers2

0

Change your target SDK Version to 19.Do not use API Level of 20 and Platform 4.4W, as Android Virtual Device.

williamj949
  • 11,166
  • 8
  • 37
  • 51
  • Amazing, it works! This took me 48 without a solution. Thanks a bunch for your contribution, I will up you once I am able to. – Tmen Aug 27 '14 at 17:44
0

The issue lies within the versions. SDK version 19 and API lvl 19 work like supposed to, where versions of 20+ do not. Installing lowered versions and selecting those solve the issue.

Tmen
  • 13
  • 3