2010-09-23 117 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工作室或...

如果問題仍然存在嘗試卸載應用程序,並再次運行它重新啓動它。