ImageView is Crashing The Application
Solution 1
the problem is in the size of the image you gonna have to set for imageview, As you already mentioned that in previous versions,it works perfect,but in newer versions,it is crashing you app,it means you haven;t added images in drawable folder, add drawable folder in your resources and add glasses
image in that folder,then clean your project and run your application,your problem would be solved then.
your error is at:
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.ImageView
12-22 22:38:39.756: E/AndroidRuntime(25460): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-22 22:38:39.756: E/AndroidRuntime(25460):
and exception is generated on line #20 and it is image view.
Solution 2
I faced the same problem, but I found the image with depth 8 cause the problems. So I use another image with other depth than 8.
Solution 3
Are you scaling the layout it is null pointer that means Android is not able to find your Drawable id(glasses), put same image in your scaled drawables or simply create a drawable folder and keep glasses in drawable folder. then it should work fine.
Crazycriss
Updated on June 04, 2022Comments
-
Crazycriss almost 2 years
This application works perfectly on my android 2.1 but when i use it on my Galaxy S3 4.1.1 it doesnt work at all and crashed
The LogCat
12-22 22:38:39.756: E/AndroidRuntime(25460): FATAL EXCEPTION: main 12-22 22:38:39.756: E/AndroidRuntime(25460): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.TripleC.twenty20/com.TripleC.twenty20.MainActivity}: android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.ImageView 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2113) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.app.ActivityThread.access$700(ActivityThread.java:139) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1224) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.os.Handler.dispatchMessage(Handler.java:99) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.os.Looper.loop(Looper.java:137) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.app.ActivityThread.main(ActivityThread.java:4918) 12-22 22:38:39.756: E/AndroidRuntime(25460): at java.lang.reflect.Method.invokeNative(Native Method) 12-22 22:38:39.756: E/AndroidRuntime(25460): at java.lang.reflect.Method.invoke(Method.java:511) 12-22 22:38:39.756: E/AndroidRuntime(25460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 12-22 22:38:39.756: E/AndroidRuntime(25460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 12-22 22:38:39.756: E/AndroidRuntime(25460): at dalvik.system.NativeStart.main(Native Method) 12-22 22:38:39.756: E/AndroidRuntime(25460): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.ImageView 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.view.LayoutInflater.createView(LayoutInflater.java:613) 12-22 22:38:39.756: E/AndroidRuntime(25460): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 12-22 22:38:39.756: E/AndroidRuntime(25460): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
Also here is my XML build, i see that it is the picture i have put up but i dont know what about the picture is the problem, if i delete it, the app works perfectly but i need the picture there
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/wood" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="Welcome To the Beta Version of 20/20's Youth Ministry New App" android:gravity="center" android:id="@+id/fragment_main_textview" android:textColor="#FFFFFF" android:textSize="10pt" /> <ImageView android:layout_width="120pt" android:id="@+id/mainLogo" android:layout_height="120pt" android:background="@drawable/glasses" android:layout_gravity="center" /> </LinearLayout>
It is now saying this
12-22 23:16:31.465: A/libc(3371): Fatal signal 11 (SIGSEGV) at 0x000009a4 (code=1), thread 3371 (ripleC.twenty20)
-
Crazycriss over 10 yearsThank you a lot, but it didnt work, the same reason for the crash comes up
-
ZORRO_BLANCO over 10 yearsI am not sure about your application, but we can just try to remove all other properties and set these properties, sure you gonna heave to leave the id too, then run, tell me what happens ;)
-
Crazycriss over 10 yearsI tried it again but it still crashed :( , might it be that the picture is in the wrong drawable folder?
-
Kumar Bibek over 10 yearsPut your picture in the "drawable" folder and check please.
-
Crazycriss over 10 yearsI did exactly that but it still crashed and saying tis "12-22 23:16:31.465: A/libc(3371): Fatal signal 11 (SIGSEGV) at 0x000009a4 (code=1), thread 3371 (ripleC.twenty20) "
-
Crazycriss over 10 yearsThank you but it is still crashing and now saying this "12-22 23:16:31.465: A/libc(3371): Fatal signal 11 (SIGSEGV) at 0x000009a4 (code=1), thread 3371 (ripleC.twenty20)"
-
Amit over 10 yearsremove application from your device, clean application and then try giving a new build, here
-
ZORRO_BLANCO over 10 yearsyes that's right, I thought you already did that, nice log tracking Hamad :)
-
Hamad over 10 yearsif you all appreciate this,then do appreciate it by up voting too :) @ZORRO_BLANCO