无法在模拟器上启动android项目

时间:2012-08-13 10:42:50

标签: android eclipse android-emulator

现在我正试图在屏幕上显示一些文字,但我的项目没有启动,我找不到准确的原因。有没有人遇到过这种情况?

在这里,我已经为您提供了详细的内容供您参考。请在下面找到

logcat的

08-13 16:02:58.823: D/AndroidRuntime(336): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
08-13 16:02:58.823: D/AndroidRuntime(336): CheckJNI is ON
08-13 16:02:58.953: D/AndroidRuntime(336): --- registering native functions ---
08-13 16:02:59.483: D/AndroidRuntime(336): Shutting down VM
08-13 16:02:59.483: D/dalvikvm(336): Debugger has detached; object registry had 1 entries
08-13 16:02:59.522: I/AndroidRuntime(336): NOTE: attach of thread 'Binder Thread #3' failed

控制台

[2012-08-13 15:50:55 - print_testing] ------------------------------
[2012-08-13 15:50:55 - print_testing] Android Launch!
[2012-08-13 15:50:55 - print_testing] adb is running normally.
[2012-08-13 15:50:55 - print_testing] No Launcher activity found!
[2012-08-13 15:50:55 - print_testing] The launch will only sync the application package on the device!
[2012-08-13 15:50:55 - print_testing] Performing sync
[2012-08-13 15:50:55 - print_testing] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Android22-API-8'
[2012-08-13 15:50:56 - print_testing] Application already deployed. No need to reinstall.
[2012-08-13 15:50:56 - print_testing] \print_testing\bin\print_testing.apk installed on device
[2012-08-13 15:50:56 - print_testing] Done!

DisplayActivity.java

public class DisplayActivity extends Activity
{   
EditText edt1,edt2;
Button btn;

@Override
public void onCreate(Bundle savedInstanceState) 
{

super.onCreate(savedInstanceState);
setContentView(R.layout.main1);


edt1 = (EditText)findViewById(R.id.editText1); 
edt2 = (EditText)findViewById(R.id.editText2);

Button btn = (Button)findViewById(R.id.button1);
btn.setOnClickListener(new View.OnClickListener() 

{

@Override
public void onClick(View v) 
{

if(edt1.getText().toString().equals("4545"))
{

String newLine = System.getProperty("line.separator");
System.out.println("Student name : Karan" + newLine + "Total no of Working days : 25" 
+ newLine +"Total no of present days : 23 " + newLine + "Total no of Absent days : 2");
        }
    }
});
 }
}

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.print.testing"
android:versionCode="1"
android:versionName="1.0" >

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

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name">
    <activity
        android:name=".DisplayActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN1" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
</application>

</manifest>

2 个答案:

答案 0 :(得分:4)

检查您的AndroidManifest.xml。它不是

<action android:name="android.intent.action.MAIN1" />

应该是

<action android:name="android.intent.action.MAIN" />

答案 1 :(得分:1)

您的AndroidManifest.xml文件应该包含此而不是“MAIN1”主要是动作而不是xml