Vetonn
Vetonn

Reputation: 11

My app works on emulator but crashes on device on startup

In my android dev in kotlin course, I create a simple to do list, the list seems perfectly fine, no error in coding everything is fixed I run the app on my emulator and it works perfectly fine, but when I run and test it it through my device through usb connection, it just crashes on startup everytime, Now I have no idea why:

I try to change the emulator api though I dont know if emulator has to do anything with it I also deleted Android Api 32 from sdk manager because I was working with that and I installed Android 10.0 because I use the same version on my device I thought it might actualy help but still nothing I take a look at the error code but there is so much into it I understand nothing this is what it shows in logcat :

2022-03-16 23:10:29.788 17445-17445/? E/om.example.tod: Unknown bits set in runtime_flags: 0x8000
2022-03-16 23:10:30.308 17445-17445/com.example.todo E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2022-03-16 23:10:30.490 17445-17445/com.example.todo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.todo, PID: 17445
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.todo/com.example.todo.MainActivity}: android.view.InflateException: Binary XML file line #2 in com.example.todo:layout/activity_main: Binary XML file line #2 in com.example.todo:layout/activity_main: Error inflating class <unknown>
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3335)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7551)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
     Caused by: android.view.InflateException: Binary XML file line #2 in com.example.todo:layout/activity_main: Binary XML file line #2 in com.example.todo:layout/activity_main: Error inflating class <unknown>
     Caused by: android.view.InflateException: Binary XML file line #2 in com.example.todo:layout/activity_main: Error inflating class <unknown>
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:858)
        at android.view.LayoutInflater.createView(LayoutInflater.java:780)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:663)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:706)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
        at com.example.todo.MainActivity.onCreate(MainActivity.kt:24)
        at android.app.Activity.performCreate(Activity.java:7893)
        at android.app.Activity.performCreate(Activity.java:7880)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3310)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7551)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
     Caused by: android.content.res.Resources$NotFoundException: Drawable com.example.todo:color/material_dynamic_neutral20 with resource ID #0x7f0501a4
2022-03-16 23:10:30.491 17445-17445/com.example.todo E/AndroidRuntime: Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.todo:color/material_dynamic_neutral20" (7f0501a4) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0501a4 a=-1 r=0x7f0501a4}
        at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:856)
        at android.content.res.ResourcesImpl.originalLoadDrawable(ResourcesImpl.java:696)
        at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:593)
        at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:307)
        at android.content.res.Resources.loadDrawable(Resources.java:932)
        at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:982)
        at android.view.View.<init>(View.java:5304)
        at android.view.ViewGroup.<init>(ViewGroup.java:684)
        at android.widget.LinearLayout.<init>(LinearLayout.java:254)
        at android.widget.LinearLayout.<init>(LinearLayout.java:250)
        at android.widget.LinearLayout.<init>(LinearLayout.java:246)
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:858)
        at android.view.LayoutInflater.createView(LayoutInflater.java:780)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:663)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:706)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
        at com.example.todo.MainActivity.onCreate(MainActivity.kt:24)
        at android.app.Activity.performCreate(Activity.java:7893)
        at android.app.Activity.performCreate(Activity.java:7880)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3310)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7551)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)

Upvotes: 0

Views: 812

Answers (1)

faisal ur rehman
faisal ur rehman

Reputation: 356

change the color code of your resource <color name="material_dynamic_neutral20">#7f0501a4</color> to <color name="material_dynamic_neutral20">#7F1712D1</color>

Upvotes: 1

Related Questions