Android模拟器,Hello程序跑不起来 本帖最后由 mosquito360 于 2010-11-22 18:11:47 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你用了java.net里的方法,抛异常了 换个模拟器,再试试,还有,如果你是eclipse创建的空的工程,不需要Ubuntu吧,Ubuntu都是编译so和源码用的 我把所有代码贴出来看看吧,就是ADT直接生成的,没有修改内容。很简单的代码。在模拟器中点可以运行,就是无法通过eclipse启动。hello.java的源码package com.hello.test;import android.app.Activity;import android.os.Bundle;public class hello extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }}main.xml代码<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hello.test" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".hello" 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="AOSP" /> </manifestLayout.xml代码<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ><TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /></LinearLayout>上边贴出的应该是所有用到的代码了吧,不知道哪里用到了java.net的方法呢? 模拟器可以跑到Home,等待很长时间也不行(等过几个小时的),程序就是跑不起来。(另外直接操作模拟器没问题)从logcat和console的信息来看,后边应该是Acitvitymanager发intent消息了,但是却没有任何动作。 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hello.test" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".hello" 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="AOSP" /> /manifest> 我照你的源码敲进去 运行出来了估计是你的配置问题 另外我也是在ubuntu下的环境 楼主是不是模拟器进入待机界面了?如果模拟器上显示左边一个锁的图标,右边一个喇叭的图标,那就是待机了,就看不到你的程序界面了需要鼠标按住左边的锁,一直向右拖动,一直拖到一个圆点的位置进行解锁,然后估计就能看到你的hello了 大家都忽视了一个问题,LZ的是64位系统,这个可能是问题根源,上面有ubuntu下成功运行的,我的系统也是ubuntu不过我的是32为而非64位,这个可能就是问题所在也未可知,楼主试试虚拟机个32位的跑跑看,如果正常就建议你换个32位系统 我朋友也有运行成功。但是我的机子却跑到这里就卡住了。看logcat的信息是他的模拟器发出了ActivityManager:Intent……这个信息,而我的却没有。我想问的就是为什么会产生这样不同的现象,还有如何解决。 没有进入待机界面。我试过直接Run这个程序呼出模拟器进入到Home界面程序跑不起来,也试过开启模拟器之后进行一些其他操作再run这个程序,还是跑不起来。 我也不确定是不是64位有影响,但是看Android都说2.2以上版本只能64位编译,所以我用的64位系统。关键还有一点,我朋友能跑起来的也是跟我一样的系统和配置。这个很纠结……所以我把能贴上来的代码和log信息都贴上来了,希望能得到解决办法 [2010-11-22 23:10:50 - xAndroid] ------------------------------[2010-11-22 23:10:50 - xAndroid] Android Launch![2010-11-22 23:10:50 - xAndroid] adb is running normally.[2010-11-22 23:10:50 - xAndroid] Performing xx.Android.HelloXX activity launch[2010-11-22 23:10:50 - xAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'X1'[2010-11-22 23:10:50 - xAndroid] Launching a new emulator with Virtual Device 'X1'[2010-11-22 23:10:56 - xAndroid] New emulator found: emulator-5554[2010-11-22 23:10:56 - xAndroid] Waiting for HOME ('android.process.acore') to be launched...[2010-11-22 23:11:43 - xAndroid] HOME is up on device 'emulator-5554'[2010-11-22 23:11:43 - xAndroid] Uploading xAndroid.apk onto device 'emulator-5554'[2010-11-22 23:11:44 - xAndroid] Installing xAndroid.apk...[2010-11-22 23:12:50 - xAndroid] Success![2010-11-22 23:12:50 - xAndroid] Starting activity xx.Android.HelloXX on device [2010-11-22 23:12:57 - xAndroid] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=xx.Android/.HelloXX } 我现在换了个思路,我在命令行执行adb shell am start -W -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.hello.test/.hello启动程序成功了。所以我觉得应该是在Run Application的时候Eclipse少执行了什么命令。现在我想知道Eclipse Run Application的时候具体执行了那些命令,或者怎么改变Run的命令?我先换个标题~ 这两天你回答的最多了,分给你吧。不过这个问题还没解决,现在有2个方向:一个是我拿硬盘挂到别人机器上运行,看下是否能执行通过。如果能就是硬件问题了。另一个方向就是Eclipse中Run Application的时候少执行了什么命令。这个帖子先结了,我另开一帖,去问第二个问题。 现在问题清楚了。我把硬盘下下来挂载到别人机器上运行通过了。启动模拟器再跑hello成功,不起动模拟器跑hello而带动模拟器启动没有跑成功。应该是在硬件上开销比较大。看来确实是机器配置的原因,硬件不够强悍。 我的也是,卡在那里出不来,用eclipse就出不来,但是单独打开模拟器就可以,现在还没解决,哪位大侠指点一下啊 在 Android手机中,链接一个外部页面,如何只呈现页面的一部分呢? google map报错 ImageView怎么确定内容的当前位置? RTSP在android中能不能实现 请问一下,一般安卓应用开发的层? android客户端访问服务器端sql server怎么做阿 初学Android开发 对Android在多个时间段 执行同一个任务的困惑 问一个问题。 运行报错.帮看看. webview插入flash问题 getContentLength()很奇怪的问题
我把所有代码贴出来看看吧,就是ADT直接生成的,没有修改内容。很简单的代码。
在模拟器中点可以运行,就是无法通过eclipse启动。hello.java的源码package com.hello.test;import android.app.Activity;
import android.os.Bundle;public class hello extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
main.xml代码<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hello.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".hello"
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="AOSP" />
</manifest
Layout.xml代码<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
上边贴出的应该是所有用到的代码了吧,不知道哪里用到了java.net的方法呢?
模拟器可以跑到Home,等待很长时间也不行(等过几个小时的),程序就是跑不起来。(另外直接操作模拟器没问题)
从logcat和console的信息来看,后边应该是Acitvitymanager发intent消息了,但是却没有任何动作。
/manifest>
估计是你的配置问题 另外我也是在ubuntu下的环境
如果模拟器上显示左边一个锁的图标,右边一个喇叭的图标,那就是待机了,就看不到你的程序界面了
需要鼠标按住左边的锁,一直向右拖动,一直拖到一个圆点的位置进行解锁,然后估计就能看到你的hello了
没有进入待机界面。
我试过直接Run这个程序呼出模拟器进入到Home界面程序跑不起来,也试过开启模拟器之后进行一些其他操作再run这个程序,还是跑不起来。
所以我把能贴上来的代码和log信息都贴上来了,希望能得到解决办法
[2010-11-22 23:10:50 - xAndroid] Android Launch!
[2010-11-22 23:10:50 - xAndroid] adb is running normally.
[2010-11-22 23:10:50 - xAndroid] Performing xx.Android.HelloXX activity launch
[2010-11-22 23:10:50 - xAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'X1'
[2010-11-22 23:10:50 - xAndroid] Launching a new emulator with Virtual Device 'X1'
[2010-11-22 23:10:56 - xAndroid] New emulator found: emulator-5554
[2010-11-22 23:10:56 - xAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2010-11-22 23:11:43 - xAndroid] HOME is up on device 'emulator-5554'
[2010-11-22 23:11:43 - xAndroid] Uploading xAndroid.apk onto device 'emulator-5554'
[2010-11-22 23:11:44 - xAndroid] Installing xAndroid.apk...
[2010-11-22 23:12:50 - xAndroid] Success!
[2010-11-22 23:12:50 - xAndroid] Starting activity xx.Android.HelloXX on device
[2010-11-22 23:12:57 - xAndroid] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=xx.Android/.HelloXX }
所以我觉得应该是在Run Application的时候Eclipse少执行了什么命令。
现在我想知道Eclipse Run Application的时候具体执行了那些命令,或者怎么改变Run的命令?
我先换个标题~
这两天你回答的最多了,分给你吧。
不过这个问题还没解决,现在有2个方向:
一个是我拿硬盘挂到别人机器上运行,看下是否能执行通过。如果能就是硬件问题了。
另一个方向就是Eclipse中Run Application的时候少执行了什么命令。
这个帖子先结了,我另开一帖,去问第二个问题。
我把硬盘下下来挂载到别人机器上运行通过了。
启动模拟器再跑hello成功,不起动模拟器跑hello而带动模拟器启动没有跑成功。应该是在硬件上开销比较大。
看来确实是机器配置的原因,硬件不够强悍。