Bug 39521 - Beta Support lib crash on compat devices: Java.Lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat
Summary: Beta Support lib crash on compat devices: Java.Lang.NoClassDefFoundError: and...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Android
Classification: Xamarin
Component: Pre-release ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2016-03-10 16:39 UTC by Josh
Modified: 2017-08-23 20:40 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Josh 2016-03-10 16:39:37 UTC
When using the beta Support.V4 & Support.V7.AppCompat libs, and using a Toolbar, and deploying to a device needing the compat lib functionality, an app will crash with `Java.Lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat`.

I've created a simple project on Github illustrating the issue. If it is ran on API 22, it works fine. If it's ran on API 19, a crash occurs with the above error.

Repo: https://github.com/LifeCoder45/MissingVectorDrawableCompat

There is a Readme there that goes further into detail.
Comment 1 Josh 2016-03-10 16:49:13 UTC
I also wonder if this will affect the usage of Vector images on ImageViews, using the `srcCompat` attribute, but have not looked into it yet.
Comment 2 jzeferino 2016-03-14 16:17:32 UTC
I'm getting the same exception when double clicking on a editext.
Minimum API is 15 and it happens in any device pre 21.

This is the log with the full exception:

Java.Lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat
  at --- End of managed exception stack trace ---
  at java.lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat
  at at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:829)
  at at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:303)
  at at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:178)
  at at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
  at at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:46)
  at at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:65)
  at at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
  at at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
  at at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963)
  at at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022)
  at at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
  at at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$WrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:280)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
  at at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at at android.support.v7.widget.ActionBarContextView.initForMode(ActionBarContextView.java:158)
  at at android.support.v7.app.AppCompatDelegateImplV7.startSupportActionModeFromWindow(AppCompatDelegateImplV7.java:787)
  at at android.support.v7.app.AppCompatDelegateImplV7.startSupportActionMode(AppCompatDelegateImplV7.java:679)
  at at android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.startAsSupportActionMode(AppCompatDelegateImplV14.java:203)
  at at android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.onWindowStartingActionMode(AppCompatDelegateImplV14.java:187)
  at at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2269)
  at at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2256)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:654)
  at at android.view.View.startActionMode(View.java:4338)
  at at android.widget.Editor.startSelectionActionMode(Editor.java:1519)
  at at android.widget.Editor$SelectionModifierCursorController.onTouchEvent(Editor.java:3613)
  at at android.widget.Editor.onTouchEvent(Editor.java:1017)
  at at android.widget.TextView.onTouchEvent(TextView.java:7601)
  at at android.view.View.dispatchTouchEvent(View.java:7384)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
  at at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
  at at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966)
  at at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418)
  at at android.app.Activity.dispatchTouchEvent(Activity.java:2424)
  at at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
  at at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914)
  at at android.view.View.dispatchPointerEvent(View.java:7564)
  at at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883)
  at at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778)
  at at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
  at at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
  at at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
  at at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
  at at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
  at at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
  at at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
  at at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
  at at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
  at at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
  at at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
  at at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
  at at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
  at at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
  at at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493)
  at at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
  at at android.os.MessageQueue.nativePollOnce(Native Method)
  at at android.os.MessageQueue.next(MessageQueue.java:132)
  at at android.os.Looper.loop(Looper.java:124)
  at at android.app.ActivityThread.main(ActivityThread.java:5103)
  at at java.lang.reflect.Method.invokeNative(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:525)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  at at dalvik.system.NativeStart.main(Native Method)
Comment 3 Simon Chopin 2016-07-11 08:45:38 UTC
I have a crash that looks related when trying to inflate an ImageView (or ImageButton) on my API 15 device. It doesn't like my vector drawables, whereas on a API 21+ it loads just fine.

Stack trace below.

Android.Content.Res.Resources+NotFoundException: File res/drawable/ic_input_add.xml from drawable resource ID #0x7f02005a ---> Org.XmlPull.V1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
07-11 10:35:51.970 E/mono-rt (32123): 
07-11 10:35:51.970 E/mono-rt (32123):   --- End of managed exception stack trace ---
07-11 10:35:51.970 E/mono-rt (32123): org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
07-11 10:35:51.970 E/mono-rt (32123): 	at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.content.res.Resources.loadDrawable(Resources.java:1948)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.content.res.Resources.getDrawable(Resources.java:672)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:128)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.TintResources.getDrawable(TintResources.java:45)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:202)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:192)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:65)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:53)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:118)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:980)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1039)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
07-11 10:35:51.970 E/mono-rt (32123): 	at md5d884ea5a30b384b8d7dd4c2145c2f997.LibraryActivity.n_onCreate(Native Method)
07-11 10:35:51.970 E/mono-rt (32123): 	at md5d884ea5a30b384b8d7dd4c2145c2f997.LibraryActivity.onCreate(LibraryActivity.java:32)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.Activity.performCreate(Activity.java:5188)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.ActivityThread.access$700(ActivityThread.java:140)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.os.Looper.loop(Looper.java:137)
07-11 10:35:51.970 E/mono-rt (32123): 	at android.app.ActivityThread.main(ActivityThread.java:4921)
07-11 10:35:51.970 E/mono-rt (32123): 	at java.lang.reflect.Method.invokeNative(Native Method)
07-11 10:35:51.970 E/mono-rt (32123): 	at java.lang.reflect.Method.invoke(Method.java:511)
07-11 10:35:51.970 E/mono-rt (32123): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
07-11 10:35:51.970 E/mono-rt (32123): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
07-11 10:35:51.970 E/mono-rt (32123): 	at dalvik.system.NativeStart.main(Native Method)
Comment 4 Jon Dick 2016-07-13 12:09:17 UTC
I believe the original problem has long since been fixed in stable releases of the support libraries.

Simon, for your issue, what version of the support libraries are you using?
Comment 5 Simon Chopin 2016-07-13 12:24:47 UTC
The Xamarin AppCompat NuGet tells me 23.4.0
Comment 6 Jon Dick 2016-07-13 12:28:29 UTC
I expect that you're seeing a bug in 23.4.0 that will be fixed very shortly with 23.4.0.1.

For now you can work around this bug by adding the following to your .csproj:

  <PropertyGroup>
    <AndroidResgenExtraArgs>--no-version-vectors</AndroidResgenExtraArgs>
  </PropertyGroup>
Comment 7 Simon Chopin 2016-07-13 13:39:44 UTC
The fix works, thanks.
Comment 8 Mark Silver 2016-12-08 10:29:40 UTC
This bug is not fixed. Either that or it has reappeared with a different cause. I'm on the latest alpha channel build for Android. 

Xamarin.Android - v7.1.0.13
SDK Tools Version: 25.2.3
SDK Platform Tools Version: 25.0.1
SDK Build Tools Version: 25.0.1

Xamarin Studio Community - Version 6.2 (build 1499)


I'm using the pre release Xamarin Android Support libraries also. 

    "Xamarin.Android.Support.v4": "25.0.1-rc1",
    "Xamarin.Android.Support.v7.AppCompat": "25.0.1-rc1",


To reproduce the error it's as simple as creating a new empty Xamarin.Android project. Change the Main activity to AppCompatActivity. Then run the app on a device < 21.

The exception will trigger in activity OnCreate, on the base parent call.

This is a major bug and needs to be looked at.
Comment 9 Cody Beyer (MSFT) 2017-08-23 20:40:37 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Android project adding just the code necessary to demonstrate the issue.
Comment 10 Cody Beyer (MSFT) 2017-08-23 20:40:47 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Android project adding just the code necessary to demonstrate the issue.