2010-09-23 37 views
63

我有一个非常简单的android项目。当我尝试运行它时,收到以下错误 消息。仿真程序正在运行,但应用程序不会启动。我找不到任何有用的信息 在线。谁能帮我?活动未开始,其当前任务已被带到前台

Warning: Activity not started, its current task has been brought to the front 

public class Profile extends Activity { 
     /*Button button1; 
     CheckBox check1, check2; 
     EditText text1;*/ 

     /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
    } 
} 

<EditText android:text="@+id/EditText01" android:id="@+id/EditText01" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" android:enabled="false"></ 
EditText><CheckBox android:text="@+id/CheckBox03" android:id="@+id/ 
CheckBox03" android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
</CheckBox> 
<CheckBox android:text="@+id/CheckBox02" android:id="@+id/CheckBox02" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
</CheckBox> 
<CheckBox android:text="@+id/CheckBox01" android:id="@+id/CheckBox01" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" android:checked="true"> 
</CheckBox> 

</LinearLayout> 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.seiservices.blending" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <application android:icon="@drawable/icon" android:label="@string/ 
app_name"> 
     <activity android:name=".Profile" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category 
android:name="android.intent.category.LAUNCHER" /> 
       <category 
android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 

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

</manifest> 

回答

100

它不是错误消息时,它是一个警告。系统试图告诉你什么:设备上的应用程序与Eclipse中的应用程序相同。而且由于应用程序已经在设备上运行,系统会告诉您它不会终止并重新启动它,而是将已运行的应用程序的活动置于前台。这很正常。 ;-)

如果您编辑您的代码并运行它(因为该应用程序随后被杀害,重新安装并启动)或者您在手机上杀死了您的进程,通过DDMS。

+1

感谢您的快速评论。但是我看不到我的应用在模拟器中运行。仿真器正在运行,我只能看到主屏幕。我应该怎么做才能看到我的应用程序?当我第一次创建应用程序时,我可以看到它在模拟器中运行。 – 2010-09-23 18:21:20

+0

我想你可能会为罗伯特的解决方案提供一个镜头 - 也许这是你的问题。否则:将您的AndroidManifest.xml上传到http://pastebin.com并在此处张贴链接,以便我们查看它。 :-) – mreichelt 2010-09-23 19:44:23

+1

要从Eclipse运行DDMS,请执行以下操作:单击窗口>打开透视图>其他...> DDMS – Will 2013-09-13 21:42:18

21

我以前见过这个 - 即使您没有进行任何代码更改,您仍想重新运行应用程序。在模拟器上,单击后退按钮(位于菜单按钮的右侧),然后像往常一样从Eclipse运行应用程序。

+1

谢谢。得到它修复。 – 2010-09-24 17:42:57

8

如果从eclipse运行应用程序而无需重新编译(如果未更改代码,则不会执行重新编译)会发生这种情况,它不会通过卸载 - 安装过程,而是将应用程序推到前面就像你从Home Launcher启动应用程序一样。这不是一个错误,而是一个“按预期工作”。

问候

0

在模拟器上,

  • 按 “家”
  • “菜单” 按钮 - >滚动列表,并选择应用程序,你 运行
  • 按“强制停止”。
4

我发现eclipse不知何故进入了一个状态,即它没有构建一个新的apk,即使有代码更改。删除APK:

RM ./bin/"YOUR APP NAME”的apk

,并重新运行从日食您的应用程序解决问题。

0

这是警告它说应用程序已经运行.. 我已经通过重新编译我的代码解决它,你可以关闭你的模拟器,并重新运行你的应用程序.. 好运 快乐编码

7

Project > Clean然后启动你的模拟器再次。

1

如果您收到此警告,这意味着您没有更改任何代码行,并且您的项目实例正在仿真器上或设备上运行。所以,如果你想再次运行,你可以:

1-在你的代码中做一些改变,然后重新编译它。

2或您可以轻松地关闭应用程序,然后使用Eclipse或Android工作室或...

如果问题仍然存在尝试卸载应用程序,并再次运行它重新启动它。

相关问题