我已经在我的索尼 x8 手机上测试了我的应用程序,它运行得很好,但是它在模拟器中不起作用,我试图重新安装 android 模拟器,删除等等......
这很烦人。当我打开我的应用程序时,我在模拟器上说的错误意外停止。
请帮忙。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainbgg"
android:orientation="vertical"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="220dp"
android:layout_height="50dp"
android:layout_gravity="left"
android:layout_marginLeft="0dp"
android:layout_marginTop="10dp"
android:scaleType="centerCrop"
android:src="@drawable/headingmain" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="300dp"
android:layout_height="20dp"
android:layout_marginLeft="102dp"
android:layout_marginTop="0dp"
android:scaleType="centerCrop"
android:src="@drawable/headingby" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="120dp"
android:layout_height="125dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="0dp"
android:layout_marginTop="27dp"
android:scaleType="centerCrop"
android:src="@drawable/ballmain" />
<LinearLayout
android:id="@+id/MainMenu"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_marginTop="10dp"
android:layout_weight="0.35"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="12dp"
android:background="@drawable/playbutton"
android:src="@drawable/playbutton" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="12dp"
android:background="@drawable/helpbutton"
android:src="@drawable/helpbutton" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="12dp"
android:background="@drawable/aboutbutton"
android:src="@drawable/aboutbutton" />
</LinearLayout>
这是activity.java:
package com.sunny.studios.marton.seoul.uefaquiz;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
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;
}
}
和日志猫:
Don't you think the problem is : java.lang.RuntimeException: Unable to start activity this????
09-17 20:32:26.892: D/dalvikvm(296): GC_EXTERNAL_ALLOC freed 801 objects / 58504 bytes in 56ms
09-17 20:32:28.333: E/dalvikvm-heap(296): 19180800-byte external allocation too large for this process.
09-17 20:32:28.333: E/GraphicsJNI(296): VM won't let us allocate 19180800 bytes
09-17 20:32:28.333: D/AndroidRuntime(296): Shutting down VM
09-17 20:32:28.343: W/dalvikvm(296): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
09-17 20:32:28.543: E/AndroidRuntime(296): FATAL EXCEPTION: main
09-17 20:32:28.543: E/AndroidRuntime(296): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sunny.studios.marton.seoul.uefaquiz/com.sunny.studios.marton.seoul.uefaquiz.MainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class <unknown>
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.os.Handler.dispatchMessage(Handler.java:99)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.os.Looper.loop(Looper.java:123)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-17 20:32:28.543: E/AndroidRuntime(296): at java.lang.reflect.Method.invokeNative(Native Method)
09-17 20:32:28.543: E/AndroidRuntime(296): at java.lang.reflect.Method.invoke(Method.java:521)
09-17 20:32:28.543: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-17 20:32:28.543: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-17 20:32:28.543: E/AndroidRuntime(296): at dalvik.system.NativeStart.main(Native Method)
09-17 20:32:28.543: E/AndroidRuntime(296): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class <unknown>
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
09-17 20:32:28.543: E/AndroidRuntime(296): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-17 20:32:28.543: E/AndroidRuntime(296): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.Activity.setContentView(Activity.java:1647)
09-17 20:32:28.543: E/AndroidRuntime(296): at com.sunny.studios.marton.seoul.uefaquiz.MainActivity.onCreate(MainActivity.java:12)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-17 20:32:28.543: E/AndroidRuntime(296): ... 11 more
09-17 20:32:28.543: E/AndroidRuntime(296): Caused by: java.lang.reflect.InvocationTargetException
09-17 20:32:28.543: E/AndroidRuntime(296): at android.widget.ImageView.<init>(ImageView.java:108)
09-17 20:32:28.543: E/AndroidRuntime(296): at java.lang.reflect.Constructor.constructNative(Native Method)
09-17 20:32:28.543: E/AndroidRuntime(296): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
09-17 20:32:28.543: E/AndroidRuntime(296): ... 22 more
09-17 20:32:28.543: E/AndroidRuntime(296): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.Bitmap.nativeCreate(Native Method)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-17 20:32:28.543: E/AndroidRuntime(296): at android.widget.ImageView.<init>(ImageView.java:118)
09-17 20:32:28.543: E/AndroidRuntime(296): ... 26 more