Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource "XX" (7f07005e) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}

When I start my app, I get this error(only in api 22), apparently it is some error facing the custom background what i made for the button_login

Error: android.content.res.Resources$NotFoundException: Resource "br.com.tecmafandroid.projeto.tecmaf:drawable/backgroud_botao_login" (7f07005e) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}

My logcat error is:

   Caused by: android.content.res.Resources$NotFoundException: Resource "br.com.tecmafandroid.projeto.tecmaf:drawable/backgroud_botao_login" (7f07005e)  is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2441)
    at android.content.res.Resources.loadDrawable(Resources.java:2381)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.view.View.<init>(View.java:3737)
    at android.widget.TextView.<init>(TextView.java:637)
    at android.widget.Button.<init>(Button.java:111)
    at android.widget.Button.<init>(Button.java:107)
    at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:70)
    at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:66)
    at android.support.v7.app.AppCompatViewInflater.createButton(AppCompatViewInflater.java:186)
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
    at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1035)
    at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
    at br.com.tecmafandroid.projeto.tecmaf.activity.TelaInicialActivity.onCreate(TelaInicialActivity.java:24) 
    at android.app.Activity.performCreate(Activity.java:5990) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
    at android.app.ActivityThread.access$800(ActivityThread.java:151) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5254) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

activity_tela_inicial(xml where the button is called):

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/background_degrade"
    tools:context=".activity.TelaInicialActivity">

    <Button
        android:id="@+id/btFacaLogin"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginBottom="24dp"
        android:background="@drawable/backgroud_botao_login"
        android:text="Faça Login"
        android:textColor="@color/textColorButton"
        app:layout_constraintBottom_toTopOf="@+id/textView6"
        app:layout_constraintEnd_toEndOf="@+id/textView6"
        app:layout_constraintStart_toStartOf="@+id/textView6" />

</android.support.constraint.ConstraintLayout>

background_botao_login(xml backgroud_botao_login):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners android:radius="20dp"></corners>

    <solid android:color="#FFFFFF"></solid>

    <stroke
        android:width="1dp"
        android:color="#C9DBE9"></stroke>

</shape>
like image 854
Luis Felipe Avatar asked Oct 15 '18 12:10

Luis Felipe


1 Answers

I have seen this problem happen when you put xml in wrong drawable folder. for example in drawable-v24 so it crash on API < 21 .

You can paste background_botao_login.xml into drawable without any api version to solve the problem.

Right click on background_botao_login and click on show in folder (file in linux) then copy it and go to previous folder and find drawable and paste in it .

like image 172
Radesh Avatar answered Oct 18 '22 22:10

Radesh