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

Xamarin.Android.Support.v4 version="25.4.0.2" targetFramework="monoandroid71" #1215

Closed
cctvbnm1111 opened this issue Jan 22, 2018 · 4 comments
Assignees

Comments

@cctvbnm1111
Copy link

cctvbnm1111 commented Jan 22, 2018

Steps to Reproduce

  1. Add nuget
  <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Annotations" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Compat" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Core.UI" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Core.Utils" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Design" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Fragment" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Media.Compat" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Transition" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.v4" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.v7.AppCompat" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.v7.RecyclerView" version="25.4.0.2" targetFramework="monoandroid71" />
  <package id="Xamarin.Android.Support.Vector.Drawable" version="25.4.0.2" targetFramework="monoandroid71" />
  1. mainactivity :AppCompatActivity
    Android.Support.V7.App.AppCompatDelegate.CompatVectorFromResourcesEnabled = true;
[mono] 
[mono] Unhandled Exception:
[mono] Android.Content.Res.Resources+NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052 ---> Org.XmlPull.V1.XmlPullParserException: Binary XML file line #15: invalid drawable tag vector
[mono]    --- End of inner exception stack trace ---
[mono]   --- End of managed Android.Content.Res.Resources+NotFoundException stack trace ---
[mono] android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
[mono] 	at android.content.res.Resources.loadDrawable(Resources.java:2096)
[mono] 	at android.content.res.Resources.getDrawable(Resources.java:700)
[mono] 	at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
[mono] 	at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:437)
[mono] 	at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
[mono] 	at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
[mono] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:202)
[mono] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
[mono] 	at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:711)
[mono] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
[mono] 	at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
[mono] 	at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:131)
[mono] 	at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:155)
[mono] 	at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:31)
[mono] 	at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:55)
[mono] 	at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
[mono] 	at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
[mono] 	at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
[mono] 	at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
[mono] 	at md5d4650294d969630d3e35ba1924da8f51.LogoActivity.n_onCreate(Native Method)
[mono] 	at md5d4650294d969630d3e35ba1924da8f51.LogoActivity.onCreate(LogoActivity.java:40)
[mono] 	at android.app.Activity.performCreate(Activity.java:5231)
[mono] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[mono] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
[mono] 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
[mono] 	at android.app.ActivityThread.access$800(ActivityThread.java:135)
[mono] 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
[mono] 	at android.os.Handler.dispatchMessage(Handler.java:102)
[mono] 	at android.os.Looper.loop(Looper.java:136)
[mono] 	at android.app.ActivityThread.main(ActivityThread.java:5001)
[mono] 	at java.lang.reflect.Method.invokeNative(Native Method)
[mono] 	at java.lang.reflect.Method.invoke(Method.java:515)
[mono] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
[mono] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
[mono] 	at dalvik.system.NativeStart.main(Native Method)
[mono] Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #15: invalid drawable tag vector
[mono] 	at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
[mono] 	at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
[mono] 	at android.content.res.Resources.loadDrawable(Resources.java:2092)
[mono] 	... 34 more
[mono] 
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Android.Content.Res.Resources+NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052 ---> Org.XmlPull.V1.XmlPullParserException: Binary XML file line #15: invalid drawable tag vector
[mono-rt]    --- End of inner exception stack trace ---
[mono-rt]   --- End of managed Android.Content.Res.Resources+NotFoundException stack trace ---
[mono-rt] android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
[mono-rt] 	at android.content.res.Resources.loadDrawable(Resources.java:2096)
[mono-rt] 	at android.content.res.Resources.getDrawable(Resources.java:700)
[mono-rt] 	at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
[mono-rt] 	at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:437)
[mono-rt] 	at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
[mono-rt] 	at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
[mono-rt] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:202)
[mono-rt] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
[mono-rt] 	at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:711)
[mono-rt] 	at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
[mono-rt] 	at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
[mono-rt] 	at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:131)
[mono-rt] 	at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:155)
[mono-rt] 	at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:31)
[mono-rt] 	at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:55)
[mono-rt] 	at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
[mono-rt] 	at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
[mono-rt] 	at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
[mono-rt] 	at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
[mono-rt] 	at md5d4650294d969630d3e35ba1924da8f51.LogoActivity.n_onCreate(Native Method)
[mono-rt] 	at md5d4650294d969630d3e35ba1924da8f51.LogoActivity.onCreate(LogoActivity.java:40)
[mono-rt] 	at android.app.Activity.performCreate(Activity.java:5231)
[mono-rt] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[mono-rt] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
[mono-rt] 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
[mono-rt] 	at android.app.ActivityThread.access$800(ActivityThread.java:135)
[mono-rt] 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
[mono-rt] 	at android.os.Handler.dispatchMessage(Handler.java:102)
[mono-rt] 	at android.os.Looper.loop(Looper.java:136)
[mono-rt] 	at android.app.ActivityThread.main(ActivityThread.java:5001)
[mono-rt] 	at java.lang.reflect.Method.invokeNative(Native Method)
[mono-rt] 	at java.lang.reflect.Method.invoke(Method.java:515)
[mono-rt] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
[mono-rt] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
[mono-rt] 	at dalvik.system.NativeStart.main(Native Method)
[mono-rt] Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #15: invalid drawable tag vector
[mono-rt] 	at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
[mono-rt] 	at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
[mono-rt] 	at android.content.res.Resources.loadDrawable(Resources.java:2092)
[mono-rt] 	... 34 more

SDK:
Mono
5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
Xamarin.Android
8.0.2.1 (Visual Studio Enterprise)

[OP edited for clarity (quoting)]

@JonDouglas
Copy link
Contributor

JonDouglas commented Jan 22, 2018

@cctvbnm1111 Can you please include the version of build-tools you are using? You can find this information in a Diagnostic Build Output.

I believe you need to use a minimum of build-tools v25+ for proper support of this version of support library. With that said, it's easiest to just use the latest version of build-tools as they are typically additive.

As a rule of thumb, you should be using a version of build-tools that is equal or greater than both the support library and <TargetFrameworkVersion>. In your case that would be v25+ across the board. Since Android is additive by nature, installing the latest usually gets you the best compatibility.

@cctvbnm1111
Copy link
Author

@JonDouglas
yes, it's v25+

demo.Droid (Debug)
Build started 2018/1/23 9:39:31.


Project "/Users/jessezhang/Projects/demo.Droid.csproj" (Build target(s)):

Target _SetLatestTargetFrameworkVersion:
Found Android SDK. API levels: 10, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26
Found Java SDK version 1.8.0.
Target _ResolveMonoAndroidSdks:
MonoAndroid Tools: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/
MonoAndroid Binaries: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin/
Android Platform API level: 25
TargetFrameworkVersion: v7.1
Android NDK: /Users/jessezhang/Documents/xamarin/android-ndk-r10c/
Android SDK: /Users/jessezhang/Documents/xamarin/android-sdk-macosx/
Android SDK Build Tools: /Users/jessezhang/Documents/xamarin/android-sdk-macosx/build-tools/25.0.3/
Java SDK: /usr/
Target _GetPrimaryCpuAbi:
_PrimaryCpuAbi=x86
Target _CheckInstantRunCondition:
Dex Fast Deployment Enabled: False
Target _SetupInstantRun:
Android Java Class for Fast Deployment:
Target _SetupApplicationJavaClass:
Application Java class: android.app.Application
Target _ValidateAndroidPackageProperties:

@JonDouglas
Copy link
Contributor

@cctvbnm1111 I was not able to reproduce this with the steps you've provided. Can you please upload a minimal, complete, and verifiable example?

I tested this both against v26 and v25 support library versions and was able to deploy & run an app against > API 19 and <= API 19.

Please also include what API level of android you are deploying to(Device/Emulator).

@jonpryor
Copy link
Member

jonpryor commented Jun 5, 2018

Closing due to non-response.

@jonpryor jonpryor closed this as completed Jun 5, 2018
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Aug 26, 2021
Changes: xamarin/monodroid@fb0d502...5676b84

  * xamarin/monodroid@5676b84b4: Bump to xamarin/androidtools@0abc0d7c (dotnet#1223)
  * xamarin/monodroid@daf1aa909: [optimization] Replace 'new T[0]' with 'Array.Empty<T> ()' to reduce allocations. (dotnet#1221)
  * xamarin/monodroid@fb848118b: [tools/msbuild] Check `device.Properties.BuildVersionSdk` for `-1` (dotnet#1222)
  * xamarin/monodroid@489a389d1: [tools/msbuild] Check device additional output to see if its the same device. (dotnet#1218)
  * xamarin/monodroid@209a7c352: [tests/AndroidMSBuildTests] Remove Unused Unit Tests (dotnet#1215)
jonpryor added a commit that referenced this issue Aug 27, 2021
Changes: xamarin/monodroid@fb0d502...5676b84

  * xamarin/monodroid@5676b84b4: Bump to xamarin/androidtools@0abc0d7c (#1223)
  * xamarin/monodroid@daf1aa909: [optimization] Replace 'new T[0]' with 'Array.Empty<T> ()' to reduce allocations. (#1221)
  * xamarin/monodroid@fb848118b: [tools/msbuild] Check `device.Properties.BuildVersionSdk` for `-1` (#1222)
  * xamarin/monodroid@489a389d1: [tools/msbuild] Check device additional output to see if its the same device. (#1218)
  * xamarin/monodroid@209a7c352: [tests/AndroidMSBuildTests] Remove Unused Unit Tests (#1215)
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants