我是Android新手。我按照此链接中的描述修改了activity_main.xml。 http://developer.android.com/training/basics/firstapp/building-ui.html
当我试图跑步时,AVD说,不幸的是你的应用程序已停止工作。
我试图在manifestfile中更改minimumsdk和targetsdk版本,但这没有帮助。
02-01 12:01:25.964: W/Trace(771): Unexpected value from nativeGetEnabledTags: 0
02-01 12:01:25.993: W/Trace(771): Unexpected value from nativeGetEnabledTags: 0
02-01 12:01:26.513: D/AndroidRuntime(771): Shutting down VM
02-01 12:01:26.513: W/dalvikvm(771): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
02-01 12:01:26.523: E/AndroidRuntime(771): FATAL EXCEPTION: main
02-01 12:01:26.523: E/AndroidRuntime(771): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.firstdevapp/com.example.firstdevapp.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class editText
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.os.Looper.loop(Looper.java:137)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-01 12:01:26.523: E/AndroidRuntime(771): at java.lang.reflect.Method.invokeNative(Native Method)
02-01 12:01:26.523: E/AndroidRuntime(771): at java.lang.reflect.Method.invoke(Method.java:511)
02-01 12:01:26.523: E/AndroidRuntime(771): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-01 12:01:26.523: E/AndroidRuntime(771): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-01 12:01:26.523: E/AndroidRuntime(771): at dalvik.system.NativeStart.main(Native Method)
02-01 12:01:26.523: E/AndroidRuntime(771): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class editText
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-01 12:01:26.523: E/AndroidRuntime(771): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.Activity.setContentView(Activity.java:1881)
02-01 12:01:26.523: E/AndroidRuntime(771): at com.example.firstdevapp.MainActivity.onCreate(MainActivity.java:12)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.Activity.performCreate(Activity.java:5104)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-01 12:01:26.523: E/AndroidRuntime(771): ... 11 more
02-01 12:01:26.523: E/AndroidRuntime(771): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.editText" on path: /data/app/com.example.firstdevapp-2.apk
02-01 12:01:26.523: E/AndroidRuntime(771): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
02-01 12:01:26.523: E/AndroidRuntime(771): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-01 12:01:26.523: E/AndroidRuntime(771): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
02-01 12:01:26.523: E/AndroidRuntime(771): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
02-01 12:01:26.523: E/AndroidRuntime(771): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
02-01 12:01:26.523: E/AndroidRuntime(771): ... 21 more
02-01 12:01:29.062: I/Process(771): Sending signal. PID: 771 SIG: 9
任何人都可以帮我找出问题吗?
答案 0 :(得分:4)
具有根本原因的相关行是这一行:
02-01 12:01:26.523: E/AndroidRuntime(771): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.editText" on path: /data/app/com.example.firstdevapp-2.apk
我希望在您的布局中,您无法将“e”变为大写,而是放入editText
而不是EditText
。
答案 1 :(得分:1)
如果没有您的代码,很难判断,但是从error inflating class editText
行开始,我猜您忘记在XML布局中将<EditText
中的E大写了