0

I am quite new to android, and I get this error at this line of my code

public void onCreate(Bundle savedInstanceState)
    {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        ....

which loads this

<?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/splash">

</LinearLayout>

with this stacktrace :

1808-1808/com.xxx.asso.xxx E/AndroidRuntime﹕ FATAL 

    EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.asso.xxx/com.xxx.asso.xxx.SplashScreen}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    at android.app.ActivityThread.access$600(ActivityThread.java:141)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
    at android.app.Activity.setContentView(Activity.java:1881)
    at com.xxx.asso.xxx.SplashScreen.onCreate(SplashScreen.java:19)
    at android.app.Activity.performCreate(Activity.java:5104)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
                at android.app.ActivityThread.access$600(ActivityThread.java:141)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:5041)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
                at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
                at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
                at android.app.Activity.setContentView(Activity.java:1881)
                at com.xxx.asso.xxx.SplashScreen.onCreate(SplashScreen.java:19)
                at android.app.Activity.performCreate(Activity.java:5104)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
                at android.app.ActivityThread.access$600(ActivityThread.java:141)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:5041)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
                at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02007f a=-1 r=0x7f02007f}
    at android.content.res.Resources.loadDrawable(Resources.java:1927)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
    at android.view.View.<init>(View.java:3330)
    at android.view.ViewGroup.<init>(ViewGroup.java:431)
        at android.widget.LinearLayout.<init>(LinearLayout.java:176)
            at android.widget.LinearLayout.<init>(LinearLayout.java:172)
                            at java.lang.reflect.Constructor.constructNative(Native Method)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                            at android.view.LayoutInflater.createView(LayoutInflater.java:587)
                            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
                            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
                            at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
                            at android.app.Activity.setContentView(Activity.java:1881)
                            at com.xxx.asso.xxx.SplashScreen.onCreate(SplashScreen.java:19)
                            at android.app.Activity.performCreate(Activity.java:5104)
                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
                            at android.app.ActivityThread.access$600(ActivityThread.java:141)
                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
                            at android.os.Handler.dispatchMessage(Handler.java:99)
                            at android.os.Looper.loop(Looper.java:137)
                            at android.app.ActivityThread.main(ActivityThread.java:5041)
                            at java.lang.reflect.Method.invokeNative(Native Method)
                            at java.lang.reflect.Method.invoke(Method.java:511)

I tried everything I found on SO but with no success

3
  • it looks like your crashing here Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path) Is this actually a drawable or is it a color ? android:background="@drawable/splash" What is the drawable defined as? Commented May 27, 2015 at 21:57
  • @inner_class7 it is a drawable : it is some .png image inside some drawable-large-mdpi folder Commented May 27, 2015 at 22:00
  • 1
    try moving it to a plain drawable folder instead looks like that folder is not the bucket of dpi your working with thus it can't find the resource Commented May 27, 2015 at 22:02

1 Answer 1

1
 Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path)

Android cannot find this drawable.

it is some .png image inside some drawable-large-mdpi folder

Perhaps you are running the app on a device or emulator that is smaller than -large, and you do not have another implementation elsewhere. Only put resources in a -large resource directory when you are overriding some edition of the resource available in a regular resource directory. So, if you have splash.png also in res/drawable-mdpi/, that's fine, but my guess is that you do not have such a drawable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.