Reputation: 168
I've edited the splash.xml file I get the "Unfortunately app has stopped" error when i try to run the app.
There was 2 images on this splash.xml file before I've edit it (when the app was working)
I've tried to re-run Eclipse and the emulator but the same problem
Here is the original splash.xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/main_bg"
android:gravity="center" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="180.0dip"
android:layout_height="180.0dip"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true"
android:src="@drawable/iconmain"
android:contentDescription="@string/app_name"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="180.0dip"
android:layout_height="105.0dip"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignParentTop="true"
android:layout_marginTop="14.0dip"
android:src="@drawable/title"
android:contentDescription="@string/app_name"/>
</RelativeLayout>
And here's the modified version:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/main_bg"
android:gravity="center" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/applogofull"/>
</RelativeLayout>
And here is the LogCat:
10-30 06:11:11.840: I/art(1961): Debugger is active
10-30 06:11:11.999: I/System.out(1961): Debugger has connected
10-30 06:11:11.999: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:12.203: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:12.403: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:12.603: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:12.803: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:13.004: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:13.204: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:13.404: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:13.605: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:13.805: I/System.out(1961): waiting for debugger to settle...
10-30 06:11:14.006: I/System.out(1961): debugger has settled (1485)
10-30 06:11:14.554: I/art(1961): Alloc sticky concurrent mark sweep GC freed 1724(90KB) AllocSpace objects, 0(0B) LOS objects, 26% free, 22MB/30MB, paused 289us total 37.744ms
10-30 06:11:14.560: I/art(1961): Alloc partial concurrent mark sweep GC freed 65(15KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 22MB/36MB, paused 491us total 5.432ms
10-30 06:11:14.569: I/art(1961): Alloc concurrent mark sweep GC freed 17(12KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 402us total 9.377ms
10-30 06:11:14.570: I/art(1961): Forcing collection of SoftReferences for 462MB allocation
10-30 06:11:14.582: I/art(1961): Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 2.325ms total 12.381ms
10-30 06:11:14.582: E/art(1961): Throwing OutOfMemoryError "Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM"
10-30 06:11:14.600: I/art(1961): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 1.374ms total 10.202ms
10-30 06:11:14.600: I/art(1961): Forcing collection of SoftReferences for 462MB allocation
10-30 06:11:14.609: I/art(1961): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 788us total 8.989ms
10-30 06:11:14.610: E/art(1961): Throwing OutOfMemoryError "Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM"
10-30 06:11:14.610: D/skia(1961): --- allocation failed for scaled bitmap
10-30 06:11:14.613: D/AndroidRuntime(1961): Shutting down VM
10-30 06:11:14.619: E/AndroidRuntime(1961): FATAL EXCEPTION: main
10-30 06:11:14.619: E/AndroidRuntime(1961): Process: com.AbdellahASKI.SoundQuiz, PID: 1961
10-30 06:11:14.619: E/AndroidRuntime(1961): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.AbdellahASKI.SoundQuiz/com.AbdellahASKI.SoundQuiz.SplashActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageView
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.access$800(ActivityThread.java:151)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.os.Handler.dispatchMessage(Handler.java:102)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.os.Looper.loop(Looper.java:135)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.main(ActivityThread.java:5254)
10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Method.invoke(Native Method)
10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Method.invoke(Method.java:372)
10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageView
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createView(LayoutInflater.java:633)
10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Activity.setContentView(Activity.java:2145)
10-30 06:11:14.619: E/AndroidRuntime(1961): at com.AbdellahASKI.SoundQuiz.SplashActivity.onCreate(SplashActivity.java:20)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Activity.performCreate(Activity.java:5990)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
10-30 06:11:14.619: E/AndroidRuntime(1961): ... 10 more
10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: java.lang.reflect.InvocationTargetException
10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Constructor.newInstance(Native Method)
10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createView(LayoutInflater.java:607)
10-30 06:11:14.619: E/AndroidRuntime(1961): ... 23 more
10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM
10-30 06:11:14.619: E/AndroidRuntime(1961): at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:988)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.Resources.loadDrawableForCookie(Resources.java:2474)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.Resources.loadDrawable(Resources.java:2381)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.<init>(ImageView.java:146)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.<init>(ImageView.java:135)
10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.<init>(ImageView.java:131)
10-30 06:11:14.619: E/AndroidRuntime(1961): ... 26 more
Thanks guys for the help but when i optimized the Image and I tried to run the app I get another error on the console (the last line is red):
[2015-10-30 13:50:45 - SoundQuiz] Dx Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
[2015-10-30 13:50:45 - SoundQuiz] Dx 1 error; aborting
[2015-10-30 13:50:45 - SoundQuiz] Conversion to Dalvik format failed with error 1
Upvotes: 0
Views: 2889
Reputation: 11
The image you added in the drawable is too big to allocate the memory in the emulator that is why you are get the OutOfmemory error because the RAM size is not enough to handle the image,you can resize the image by reducing its size and resolutions.
Upvotes: 0
Reputation: 10947
You are exceding the memory limit when loading the image. Maybe is too big.
there could be different approaches:
Tell the system that the app will require more memory, edit the manifest to add android:largeHeap="true"
in application
<application
...
android:largeHeap="true" >
Upvotes: 1