Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on startup on API 15 - Resources$NotFoundException #958

Closed
barbeau opened this issue Jan 7, 2019 · 1 comment
Closed

Crash on startup on API 15 - Resources$NotFoundException #958

barbeau opened this issue Jan 7, 2019 · 1 comment
Labels
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Jan 7, 2019

Summary:

Starting the app with master branch dev build on an API 15 emulator I'm seeing a crash with:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joulespersecond.seattlebusbot/org.onebusaway.android.ui.HomeActivity}: android.view.InflateException: Binary XML file line #76: Error inflating class ImageButton
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
        at android.app.ActivityThread.access$600(ActivityThread.java:123)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4424)
        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:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #76: Error inflating class ImageButton
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at org.onebusaway.android.ui.HomeActivity.onCreate(HomeActivity.java:358)
        at android.app.Activity.performCreate(Activity.java:4466)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
        at android.app.ActivityThread.access$600(ActivityThread.java:123) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:4424) 
        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:784) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/zoom_out_button.xml from drawable resource ID #0x7f0801b3
        at android.content.res.Resources.loadDrawable(Resources.java:1928)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
        at android.widget.ImageView.<init>(ImageView.java:119)
        at android.widget.ImageButton.<init>(ImageButton.java:85)
        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73)
        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:69)
        at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:202)
        at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:122)
        at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
        at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:668)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at org.onebusaway.android.ui.HomeActivity.onCreate(HomeActivity.java:358) 
        at android.app.Activity.performCreate(Activity.java:4466) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
        at android.app.ActivityThread.access$600(ActivityThread.java:123) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:4424) 
        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:784) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/zoom_out_button_pressed.xml from drawable resource ID #0x7f0801b5
        at android.content.res.Resources.loadDrawable(Resources.java:1928)
        at android.content.res.Resources.getDrawable(Resources.java:664)
        at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
        at android.content.res.Resources.loadDrawable(Resources.java:1925)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
        at android.widget.ImageView.<init>(ImageView.java:119) 
        at android.widget.ImageButton.<init>(ImageButton.java:85) 
        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73) 
        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:69) 
        at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:202) 
        at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:122) 
        at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266) 
        at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:668) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at org.onebusaway.android.ui.HomeActivity.onCreate(HomeActivity.java:358) 
        at android.app.Activity.performCreate(Activity.java:4466) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
        at android.app.ActivityThread.access$600(ActivityThread.java:123) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:4424) 
        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:784) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_zoom_out.xml from drawable resource ID #0x7f08017a
        at android.content.res.Resources.loadDrawable(Resources.java:1928)
    	at android.content.re

Looks like this is related to ic_zoom_in.xml and other vector files that were introduced back in 2.3.x for the map zoom buttons. More vector resources were just added for the occupancy feature - I need to review and see if this issue exists prior to adding occupancy.

Steps to reproduce:

Start the app on an API 15 emulator (current master branch)

Expected behavior:

Startup without crashing

Observed behavior:

Crash

Device and Android version:

Emulator API 15 - WBGA Nexus S w/ Google APIs

@barbeau barbeau added the bug label Jan 7, 2019
@barbeau barbeau changed the title Crash on startup on API 15 Crash on startup on API 15 - Resources$NotFoundException Jan 8, 2019
@barbeau barbeau added this to the v2.3.x milestone Jan 8, 2019
@barbeau
Copy link
Member Author

barbeau commented Jan 8, 2019

Looks like this was introduced with the occupancy work - the addition of vectorDrawables.useSupportLibrary = true in build.gradle is what triggers this.

Related mapbox-gl-native issue:
mapbox/mapbox-gl-native#13099

And workaround PR to address it:
mapbox/mapbox-gl-native#13144

The workaround is essentially to remove vectorDrawables.useSupportLibrary = true (so default to false) and then reference some color values directly in XML vector files instead of using the @color/xyz reference (if needed).

It seems the support libraries and/or Android Studio are completely broken for this:

  1. This should just work accordingly to all the docs I've seen on vector icons
  2. If it doesn't work, Android Studio should flag this as not being compatible with a minSdkVersion 15

@barbeau barbeau closed this as completed in 4e45719 Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant