2014-07-01 13 views
6

Wenn mir jemand damit helfen könnte. Ich habe Android SDK heruntergeladen und alles andere für die Android-Programmierung benötigt, und ich habe einige Probleme mit (lustig zu sagen) Hallo Welt konfrontiert.targetSdkVersion Einstellung

Ich bekomme einfach nicht die Sache mit TarketSdkVersion Einstellung in AppManifest. Immer dann, wenn es nicht auf „13“ (habe gerade bemerkt, 8, die meine minSdkVersion ist funktioniert auch) Anwendung hat „Leider Anwendung funktioniert nicht mehr“ Bildschirm mit diesem in LogCat:

07-01 01:26:47.820: E/AndroidRuntime(902): FATAL EXCEPTION: main 
07-01 01:26:47.820: E/AndroidRuntime(902): Process: pl.bbZoftware.eclipsestandalone, PID: 902 
07-01 01:26:47.820: E/AndroidRuntime(902): java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.bbZoftware.eclipsestandalone/pl.bbZoftware.eclipsestandalone.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.access$800(ActivityThread.java:138) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.os.Handler.dispatchMessage(Handler.java:102) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.os.Looper.loop(Looper.java:136) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.main(ActivityThread.java:5026) 
07-01 01:26:47.820: E/AndroidRuntime(902): at java.lang.reflect.Method.invokeNative(Native Method) 
07-01 01:26:47.820: E/AndroidRuntime(902): at java.lang.reflect.Method.invoke(Method.java:515) 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 
07-01 01:26:47.820: E/AndroidRuntime(902): at dalvik.system.NativeStart.main(Native Method) 
07-01 01:26:47.820: E/AndroidRuntime(902): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275) 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872) 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129) 
07-01 01:26:47.820: E/AndroidRuntime(902): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Activity.setContentView(Activity.java:1930) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77) 
07-01 01:26:47.820: E/AndroidRuntime(902): at pl.bbZoftware.eclipsestandalone.MainActivity.onCreate(MainActivity.java:14) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Activity.performCreate(Activity.java:5242) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
07-01 01:26:47.820: E/AndroidRuntime(902): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161) 
07-01 01:26:47.820: E/AndroidRuntime(902): ... 11 more 
07-01 01:26:55.340: I/Process(902): Sending signal. PID: 902 SIG: 9 

ich nicht, ob dies beabsichtigt ist , Ich habe ein paar SDK-Fehler oder etwas anderes. Ich googelte nach Antworten, konnte aber keine finden. Sagen Sie mir, ob ich weitere Informationen aus dem Projekt hinzufügen und nach Ihren Antworten suchen soll.

EDIT: Forgot hinzufügen, ich habe ein Android-Gerät mit 4.4.2 KitKat, also wollte ich Projekt Ziel auf 20 gesetzt. Das ist, wie ich diese Fehler bemerkt.

EDIT2:

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

activity_main.xml:

<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" 
    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="pl.bbZoftware.eclipsestandalone.MainActivity" > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="@string/hello_world" /> 

</RelativeLayout> 

EDIT3:

Manifest-Datei:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="pl.bbZoftware.eclipsestandalone" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="13" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      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> 

</manifest> 
+0

den Code Bitte senden Sie für 'onCreate' für Ihre' MainActivity' Klasse. Veröffentlichen Sie auch das XML des Layouts, das Sie verwenden, wenn Sie 'setContentView' aufrufen. Die wichtige Information ist die Nachricht in der letzten "Caused by" -Zeile in der Stack-Ablaufverfolgung: "Sie können Swipe-Entlassung und die Aktionsleiste nicht kombinieren". –

+0

Ich habe diese Nachricht bemerkt, verstehe einfach nicht, was ich damit machen soll.Das ist sauberes Projekt, ich habe nichts außer targetSdkVersion geändert. – bbZ

+0

Vielleicht ist das Problem nicht mit Code, sondern mit AVD? Es gibt mein Setup davon: [screenshot] (http://puu.sh/9RyU6/b90bf52633.png) – bbZ

Antwort

12

Ich habe gerade gefunden, wo das Problem war.

Verwenden Sie nicht die API-Stufe 20 und die Plattform 4.4W als virtuelles Android-Gerät. Mit Level 19 und Platform 4.2.2 auf ADV eingestellt läuft alles wie es sollte.

+0

ich hatte das gleiche Problem. gerade funktioniert, nachdem ich von API 20 zu API 19 –

+0

was sollte die targetsdkversion in manifest.xml-Datei für 4.4.2 und API-Ebene 19 –

+0

Es sollte 19 sein, wenn das Ihr Ziel ist. – bbZ

1

meisten wahrscheinlich Sie machen Fehler auf activity_main.xml

Auch Ziel für 4.4.2 Kitkat ist 19. Überprüfen Sie in diesem android api levels page.

+0

Ich habe diese Datei nicht einmal bearbeitet. Danke für die Info, leider funktioniert 19 nicht obwohl – bbZ

3

Entfernen Sie einfach android:targetSdkVersion von AndroidManifest.xml

Fabrikat folgende Änderungen: Von

<uses-sdk 
android:minSdkVersion="8" 
android:targetSdkVersion="17" /> 

An:

<uses-sdk android:minSdkVersion="8" /> 
-2

Android API 20 Kompilierung Probleme gibt. Stellen Sie sicher, dass Sie die API 19 verwenden, und legen Sie sie während der Entwicklung als Targeted SDK fest.

0

ändern targetSdkVersion in [project directory]\app\build.gradle auf etwas weniger als oder gleich 19. Änderung:

defaultConfig { 
    applicationId '....' 
    minSdkVersion 8 
    targetSdkVersion 21 
} 

An:

defaultConfig { 
    applicationId '....' 
    targetSdkVersion 19 
} 
Verwandte Themen