我正在尝试测试一个应用页面,但它一直在崩溃。但是,与stackoverflow上的其他问题不同,logcat不会显示错误。我不知道出了什么问题,如果有人能为我指出错误,我会非常感激。 我知道我主要有未完成的代码,但我没有执行任何代码,所以我认为没关系。
这是日志文件
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.230 2347: 2347 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.230 2347: 2347 W/linker ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.270 2347: 2347 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): CheckJNI is ON
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.360 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Trying to load lib libjavacore.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.370 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Added shared lib libjavacore.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.400 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Trying to load lib libnativehelper.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.400 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Added shared lib libnativehelper.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.400 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:49.670 2347: 2347 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:50.400 2347: 2347 E/memtrack ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Couldn't load memtrack module (No such file or directory)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:50.400 2347: 2347 E/android.os.Debug ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): failed to load memtrack module: -2
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:50.740 2347: 2347 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Calling main entry com.android.commands.pm.Pm
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:50.790 2347: 2347 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Shutting down VM
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:50.800 2347: 2354 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Debugger has detached; object registry had 1 entries
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.550 2358: 2358 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.550 2358: 2358 W/linker ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.600 2358: 2358 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): CheckJNI is ON
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.690 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Trying to load lib libjavacore.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.690 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Added shared lib libjavacore.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.720 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Trying to load lib libnativehelper.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.720 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Added shared lib libnativehelper.so 0x0
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.720 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:51.990 2358: 2358 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:52.640 2358: 2358 E/memtrack ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Couldn't load memtrack module (No such file or directory)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:52.640 2358: 2358 E/android.os.Debug ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): failed to load memtrack module: -2
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.180 2358: 2358 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Calling main entry com.android.commands.am.Am
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.300 1269: 1434 I/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.safety/.MainActivity} from pid 2358
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.480 923: 923 D/gralloc ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Registering a buffer in the process that created it. This may cause memory ordering problems.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/SurfaceFlinger ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): glCheckFramebufferStatusOES error -1043711944
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/SurfaceFlinger ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.490 923: 923 E/libEGL ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): called unimplemented OpenGL ES API
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.530 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 76 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.530 1269: 1434 W/WindowManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Screenshot failure taking screenshot for (164x246) to layer 21005
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.730 2358: 2358 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Shutting down VM
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.740 2358: 2365 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Debugger has detached; object registry had 1 entries
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.860 1269: 1315 I/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Start proc com.example.safety for activity com.example.safety/.MainActivity: pid=2374 uid=10052 gids={50052}
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.880 1269: 1284 I/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Killing 1472:com.android.music/u0a32 (adj 15): empty for 1808s
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.910 1269: 1284 I/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Killing 1415:com.android.printspooler/u0a39 (adj 15): empty for 1809s
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:53.950 1269: 1431 W/MediaFocusControl ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): RemoteControlClient died
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:54.060 2374: 2374 D/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Not late-enabling CheckJNI (already on)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:54.400 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 57 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:55.020 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 314 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:55.570 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 346 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:55.960 2374: 2374 D/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Shutting down VM
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.000 2374: 2374 W/dalvikvm ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): threadid=1: thread exiting with uncaught exception (group=0xb1d79b20)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.080 2374: 2374 E/AndroidRuntime ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): FATAL EXCEPTION: main
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Process: com.example.safety, PID: 2374
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.safety/com.example.safety.MainActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class Layout
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread.access$800(ActivityThread.java:135)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.os.Handler.dispatchMessage(Handler.java:102)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.os.Looper.loop(Looper.java:136)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread.main(ActivityThread.java:5017)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at java.lang.reflect.Method.invokeNative(Native Method)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at java.lang.reflect.Method.invoke(Method.java:515)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at dalvik.system.NativeStart.main(Native Method)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class Layout
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.Activity.setContentView(Activity.java:1929)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at com.example.safety.MainActivity.onCreate(MainActivity.java:17)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.Activity.performCreate(Activity.java:5231)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): ... 11 more
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.Layout" on path: DexPathList[[zip file "/data/app/com.example.safety-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.safety-2, /system/lib]]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): ... 24 more
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.340 1269: 1570 W/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Force finishing activity com.example.safety/.MainActivity
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.690 1269: 1570 I/WindowManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Screenshot max retries 4 of Token{b2388600 ActivityRecord{b22931f8 u0 com.example.safety/.MainActivity t10 f}} appWin=Window{b23ac578 u0 Starting com.example.safety} drawState=4
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.690 1269: 1570 W/WindowManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Screenshot failure taking screenshot for (320x480) to layer 21010
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:56.910 1269: 1284 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 68 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:57.150 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 53 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:57.210 1269: 1284 W/ActivityManager ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Activity pause timeout for ActivityRecord{b22931f8 u0 com.example.safety/.MainActivity t10 f}
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:57.340 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 100 frames! The application may be doing too much work on its main thread.
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): [ 10-02 22:09:57.540 1269: 1283 I/Choreographer ]
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Skipped 127 frames! The application may be doing too much work on its main thread.
我检查了我的main.xml中的包/活动名称是否相同,看起来是一样的
package com.example.safety;
import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.EditText;
public class MainActivity extends ActionBarActivity {
@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.
EditText newDestination;
EditText newLocation;
// newDestination= (EditText) findViewById(R.id.newD);
// newLocation= (EditText) findViewById(R.id.newLoc);
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
if (id==R.id.goBackButton) {
//go back to enter locatoin page
}
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl("http://developer.android.com/guide/webapps/webview.html");
return super.onOptionsItemSelected(item);
}
}
清单中还有默认活动启动(我现在只有一个活动)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light" >
<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>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
这是我的活动页面,以防您需要查看。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/goBackButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginTop="23dp"
android:text="@string/returnToStart" />
<Layout
android:id="@+id/layout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/estimatedTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/goBackButton"
android:layout_below="@+id/goBackButton"
android:layout_marginLeft="10dp"
android:layout_marginTop="23dp"
android:text="@string/chosenRouteTime"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_alignLeft="@+id/goBackButton"
android:layout_alignRight="@+id/goBackButton"
android:layout_below="@+id/estimatedTime"
android:layout_marginTop="12dp"
android:contentDescription="@string/mapDescriptor"
android:scaleType="fitXY"
android:src="@drawable/map" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignRight="@+id/imageView1"
android:layout_below="@+id/imageView1" />
</RelativeLayout>
答案 0 :(得分:3)
Layout
不是Android SDK中的有效代码,因此当您尝试创建XML文件中定义的界面时,您的应用会崩溃。
尝试更新XML文件第16行的Layout
以获取其他内容,以适合此列表为准:http://developer.android.com/guide/topics/ui/declaring-layout.html#CommonLayouts
如果您愿意,也可以通过继承ViewGroup
来创建自己的 - http://developer.android.com/reference/android/view/ViewGroup.html