我得到了一个 AndroidRunTime 错误,不知道我做错了什么。如果我尝试从一项活动转到下一项活动,则会出现问题。如果我启动应用程序一切正常,我可以从一项活动更改为下一项活动。但是一段时间后它停止工作,虽然活动非常相似......
日志猫:
Tag: AndroidRunTime
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.moja.wbf/com.moja.wbf.GL}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.os.Looper.loop(Looper.java:137)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread.main(ActivityThread.java:5041)
09-05 08:15:49.681: E/AndroidRuntime(815): at java.lang.reflect.Method.invokeNative(Native Method)
09-05 08:15:49.681: E/AndroidRuntime(815): at java.lang.reflect.Method.invoke(Method.java:511)
09-05 08:15:49.681: E/AndroidRuntime(815): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-05 08:15:49.681: E/AndroidRuntime(815): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-05 08:15:49.681: E/AndroidRuntime(815): at dalvik.system.NativeStart.main(Native Method)
09-05 08:15:49.681: E/AndroidRuntime(815): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
09-05 08:15:49.681: E/AndroidRuntime(815): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-05 08:15:49.681: E/AndroidRuntime(815): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.Activity.setContentView(Activity.java:1881)
09-05 08:15:49.681: E/AndroidRuntime(815): at com.moja.wbf.GL.onCreate(GL.java:13)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.Activity.performCreate(Activity.java:5104)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
09-05 08:15:49.681: E/AndroidRuntime(815): ... 11 more
09-05 08:15:49.681: E/AndroidRuntime(815): Caused by: java.lang.reflect.InvocationTargetException
09-05 08:15:49.681: E/AndroidRuntime(815): at java.lang.reflect.Constructor.constructNative(Native Method)
09-05 08:15:49.681: E/AndroidRuntime(815): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
09-05 08:15:49.681: E/AndroidRuntime(815): ... 23 more
09-05 08:15:49.681: E/AndroidRuntime(815): Caused by: java.lang.OutOfMemoryError
09-05 08:15:49.681: E/AndroidRuntime(815): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.content.res.Resources.loadDrawable(Resources.java:1965)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.View.<init>(View.java:3330)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.View.<init>(View.java:3259)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.view.ViewGroup.<init>(ViewGroup.java:425)
09-05 08:15:49.681: E/AndroidRuntime(815): at android.widget.RelativeLayout.<init>(RelativeLayout.java:210)
09-05 08:15:49.681: E/AndroidRuntime(815): ... 26 more
XML 代码:
<?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"
android:background="@drawable/eins" >
<Button
android:id="@+id/button1"
android:layout_width="150dp"
android:layout_height="75dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:background="@drawable/button"
android:onClick="Zwei"
android:text="WEITER" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="44dp"
android:layout_marginLeft="22dp"
android:src="@drawable/Rad" />
</RelativeLayout>