开发者

Newbie problem: Unable to launch Android application in console

as a newbie, I tried out the HelloAndroid example at de开发者_如何学Goveloper.android.com. After apgrading the UI to XNL layout as described, I get these error messages in the console log:

[2010-08-26 11:44:49 - HelloAndroid] WARNING: Application does not specify an API level requirement! [2010-08-26 11:44:49 - HelloAndroid] Device API version is 8 (Android 2.2)

The programmatic UI layout worked fine before. Where die I make a mistake?


Open your AndroidManifest.xml file and add this tag below your </application> tag

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

Edit

This is just a warning and all it means is you need to put the Minimum SDK number in your AndroidManifest.xml.Check whether you have added a TextView to your layout and add a text to it?. Also see to it that it is visible on the layout(set a proper height and width)


Ok, the error messages do not appear any more, but the app does not start anyway. This is the complete AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.helloandroid"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".HelloAndroid"
                  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>
    <uses-sdk android:minSdkVersion="8" />
</manifest> 

This is main.xml:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/textview"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"  
  android:text="@string/hello"/>

This is strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, HelloAndroid!</string>
    <string name="app_name">Hello, Android String</string>
</resources>

This is the Eclipse log:

[2010-08-26 16:05:41 - HelloAndroid] ------------------------------

[2010-08-26 16:05:41 - HelloAndroid] Android Launch!

[2010-08-26 16:05:41 - HelloAndroid] adb is running normally.

[2010-08-26 16:05:41 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch

[2010-08-26 16:05:41 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'Testprogramm'

[2010-08-26 16:05:41 - HelloAndroid] Launching a new emulator with Virtual Device 'Testprogramm'

[2010-08-26 16:05:42 - HelloAndroid] New emulator found: emulator-5554

[2010-08-26 16:05:42 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...

[2010-08-26 16:06:17 - HelloAndroid] HOME is up on device 'emulator-5554'

[2010-08-26 16:06:17 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'

[2010-08-26 16:06:19 - HelloAndroid] Installing HelloAndroid.apk...

[2010-08-26 16:07:02 - HelloAndroid] Success!

[2010-08-26 16:07:02 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device

[2010-08-26 16:07:05 - HelloAndroid] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloandroid/.HelloAndroid }

After more than two minutes without activity I started the app again:

[2010-08-26 16:09:16 - HelloAndroid] ------------------------------

[2010-08-26 16:09:16 - HelloAndroid] Android Launch!

[2010-08-26 16:09:16 - HelloAndroid] adb is running normally.

[2010-08-26 16:09:16 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch

[2010-08-26 16:09:16 - HelloAndroid] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Testprogramm'

[2010-08-26 16:09:19 - HelloAndroid] Application already deployed. No need to reinstall.

[2010-08-26 16:09:19 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device

[2010-08-26 16:09:21 - HelloAndroid] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloandroid/.HelloAndroid }

[2010-08-26 16:09:21 - HelloAndroid] ActivityManager: Warning: Activity not started, its current task has been brought to the front

Any ideas?


I have gotten this error before. What I did was make sure that nothing else is running in the emulator. If the emulator has another program running it can sometimes prohibit the new task from starting. I don't know why.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜