java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mysite.android.app/com.mysite.android.app.NameApp}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3625)
at android.app.ActivityThread.access$2300(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1622)
at com.mysite.android.appAppOne.onCreate(AppOne.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) ... 12 more Caused by: java.lang.reflect.InvocationTargetException
at android.widget.RelativeLayout.<init>(RelativeLayout.java:171)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1705)
at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
at android.view.View.<init>(View.java:1850)
at android.view.View.<init>(View.java:1799)
at android.view.ViewGroup.<init>(ViewGroup.java:283)
... 26 more android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1622)
at com.mysite.android.appAppOne.onCreate(AppOne.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3625)
at android.app.ActivityThread.access$2300(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException
at android.widget.RelativeLayout.<init>(RelativeLayout.java:171)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1705)
at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
at android.view.View.<init>(View.java:1850)
at android.view.View.<init>(View.java:1799)
at android.view.ViewGroup.<init>(ViewGroup.java:283)
... 26 more java.lang.reflect.InvocationTargetException
at android.widget.RelativeLayout.<init>(RelativeLayout.java:171)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1622)
at com.mysite.android.appAppOne.onCreate(AppOne.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3625)
at android.app.ActivityThread.access$2300(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1705)
at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
at android.view.View.<init>(View.java:1850)
at android.view.View.<init>(View.java:1799)
at android.view.ViewGroup.<init>(ViewGroup.java:283)
... 26 more java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1705)
at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
at android.view.View.<init>(View.java:1850)
at android.view.View.<init>(View.java:1799)
at android.view.ViewGroup.<init>(ViewGroup.java:283)
at android.widget.RelativeLayout.<init>(RelativeLayout.java:171)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1622)
at ccom.mysite.android.app.onCreate(AppOne.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3625)
at android.app.ActivityThread.access$2300(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
的onCreate(AppOne.java:29):Android-這是什麼錯誤:無法啓動活動ComponentInfo?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myform);
tvTip = (TextView) findViewById(R.id.tvTip);
tvTotalCost = (TextView) findViewById(R.id.tvTotalCost);
tvPercent = (TextView) findViewById(R.id.tvPercent);
}
和myForm會:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ui="http://schemas.android.com/apk/res/com.mysite.android.app.ui"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">
<FrameLayout android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/title" />
<LinearLayout android:id="@+id/amoutLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_above="@+id/percents"
android:layout_margin="4dip"
android:padding="8dip"
android:background="@drawable/box"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView style="@style/Text"
android:text="Amount:"
android:minWidth="140dip"
android:maxWidth="140dip"/>
<TextView style="@style/Text"
android:id="@+id/inputText"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView style="@style/Text"
android:text="Tip:"
android:minWidth="140dip"
android:maxWidth="140dip"/>
<TextView style="@style/Text"
android:id="@+id/tvTip"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView style="@style/Text"
android:text="Total Cost:"
android:textStyle="bold"
android:minWidth="140dip"
android:maxWidth="140dip"/>
<TextView style="@style/Text"
android:id="@+id/tvTotalCost"
android:text=""
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/percents"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/digitalkeyboard"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:orientation="horizontal"
android:gravity="center">
<Button android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10%"
android:onClick="onButtonClick"
android:background="@drawable/ic_button_percent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<Button android:id="@+id/button15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15%"
android:onClick="onButtonClick"
android:background="@drawable/ic_button_percent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<Button android:id="@+id/button20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20%"
android:onClick="onButtonClick"
android:background="@drawable/ic_button_percent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<Button android:id="@+id/button25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="25%"
android:onClick="onButtonClick"
android:background="@drawable/ic_button_percent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<Button android:id="@+id/button30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30%"
android:onClick="onButtonClick"
android:background="@drawable/ic_button_percent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<TextView android:id="@+id/tvPercent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="10%"
android:textColor="#000"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
</LinearLayout>
<com.mysite.android.app.ui.DigitalKeyboard
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/digitalkeyboard"
android:layout_width="320dip"
android:layout_height="wrap_content"
android:layout_above="@+id/ad_banner" />
<com.google.ads.AdView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ad_banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/admob_unit_id"/>
可以請你在這裏更新您的代碼 –