当我运行程序而没有在eclipse中进行任何更改时,我收到此错误:
这是代码部分:
package com.exampl.notes;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
当我在我的Android设备上运行时,这是LogCat中的所有错误和警告,这些是以红色和橙色显示的:
06-28 20:26:12.968: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:13.028: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:13.898: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:13.948: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:14.008: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:14.078: E/qcom_sensors_hal(749): hal_process_report_ind: Bad item quality: 11
06-28 20:26:34.518: W/dalvikvm(14995): JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xff
06-28 20:26:34.518: W/dalvikvm(14995): string: 'en_Latn_US_?_US'
06-28 20:26:34.518: W/dalvikvm(14995): in Llibcore/icu/ICU;.addLikelySubtags:(Ljava/lang/String;)Ljava/lang/String; (NewStringUTF)
06-28 20:26:34.528: E/dalvikvm(14995): VM aborting
06-28 20:26:34.528: A/libc(14995): Fatal signal 6 (SIGABRT) at 0x00003a93 (code=-6), thread 14995 (om.exampl.notes)
06-28 20:26:34.848: W/ActivityManager(749): Force finishing activity com.exampl.notes/.MainActivity
06-28 20:26:34.948: W/ActivityManager(749): Exception thrown during pause
06-28 20:26:34.948: W/ActivityManager(749): android.os.DeadObjectException
06-28 20:26:34.948: W/ActivityManager(749): at android.os.BinderProxy.transact(Native Method)
06-28 20:26:34.948: W/ActivityManager(749): at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:660)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:765)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2497)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2374)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2068)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:9736)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:9629)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:10280)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:9825)
06-28 20:26:34.948: W/ActivityManager(749): at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
06-28 20:26:44.538: W/EventLoggerService(3926): Unable to send logs Error code: 262160 | The connection was not attempted due to lack of network connectivity.
布局文件在这里:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.exampl.notes.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
android manifest.xml就在这里
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exampl.notes"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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>
</manifest>