Reputation: 3432
I am trying to run my first android app. I follow tutorial 'My first App' on developer.android.com.
activity_main.xml is simple:
<LinearLayout 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:orientation="horizontal"
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=".MainActivity" >
<EditText
android:id="@+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/send_button" />
</LinearLayout>
MainActivity.java is as default.
The problem is that when I run my Andoid app it does open new virtual device but with black screen and a few buttons on the right pane. So there is nothing displayed from my activity_main.xml.
In console I see such output:
[2014-02-11 14:21:20 - MyFirstApp] ------------------------------
[2014-02-11 14:21:20 - MyFirstApp] Android Launch!
[2014-02-11 14:21:20 - MyFirstApp] adb is running normally.
[2014-02-11 14:21:20 - MyFirstApp] Performing com.example.myfirstapp.MainActivity activity launch
[2014-02-11 14:21:20 - MyFirstApp] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-02-11 14:21:34 - MyFirstApp] Launching a new emulator with Virtual Device 'MyVirtualDevice'
[2014-02-11 14:22:17 - MyFirstApp] emulator-5554 disconnected! Cancelling 'com.example.myfirstapp.MainActivity activity launch'!
[2014-02-11 14:22:54 - Emulator] Failed to create Context 0x3005
[2014-02-11 14:22:54 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
[2014-02-11 14:22:54 - Emulator] WARNING: Data partition already in use. Changes will not persist!
[2014-02-11 14:22:54 - Emulator] WARNING: SD Card image already in use: C:\Users\Vova\.android\avd\MyVirtualDevice.avd/sdcard.img
[2014-02-11 14:22:54 - Emulator] WARNING: Cache partition already in use. Changes will not persist!
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:54 - Emulator] could not get wglGetExtensionsStringARB
[2014-02-11 14:22:55 - Emulator] emulator: warning: opening audio input failed
[2014-02-11 14:22:55 - Emulator]
[2014-02-11 14:22:56 - MyFirstApp] New emulator found: emulator-5556
[2014-02-11 14:22:56 - MyFirstApp] Waiting for HOME ('android.process.acore') to be launched...
[2014-02-11 14:23:08 - MyFirstApp] emulator-5556 disconnected! Cancelling 'com.example.myfirstapp.MainActivity activity launch'!
My AndroidManifest.xml is :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.myfirstapp.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>
What can be wrong?
Thank you!
Upvotes: 1
Views: 2217
Reputation: 5068
do you have the sdk for api 18?.becuase you have set this in your manifest.try to set target version to that one, that you have installed.
Upvotes: 0
Reputation: 906
It seems to be a problem with your IDE, not your code. The console often states that the device disconnected and it therefore cancelled your program.
It would help, if we'd know what IDE you're working in. Android Studio, Eclipse or another?
Then someone probably could give you more specific advice how to solve the problem with the AVD, if you can't figure it out yourself. ;)
Upvotes: 0
Reputation: 7752
Welcome to the world of Android development. There's a few things here:
Upvotes: 1