Xamarin支持库从24.2.1更新到25.0.1-rc1后,Android应用启动时崩溃

时间:2016-12-12 17:02:42

标签: android xamarin android-support-library

我最近将我的Xamarin Android应用从Xamarin.Android.Support.* 24.2.1更新为Xamarin.Android.Support.* 25.0.1-rc1,在应用启动时,我遇到了以下崩溃(100%次):

  

Java.Interop.JniEnvironmentFile res / drawable / abc_vector_test.xml 来自   可绘制的资源ID#0x7f020052原始   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()< 8b63ef277e2c4e9d9f893013919f3ba1>:0   Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualBooleanMethod(JniObjectReference   实例,JniObjectReference类型,JniMethodInfo方法,   JniArgumentValue * args)< 554948e16e364ff9b0647fa258ff9398>:0   Android.Runtime.JNIEnv.CallNonvirtualBooleanMethod(IntPtr jobject,   IntPtr jclass,IntPtr jmethod,JValue *   PARMS)LT; 06feabe0ae89449c881f9479237416ed>:0   Android.Support.V7.App.AppCompatActivity.SupportRequestWindowFeature(INT   FEATUREID)LT; 2653bed97fbe416083d2f0e662e3d9c0>:0

我没有使用res/drawable/abc_vector_test.xml资源,所以不确定这次崩溃是什么。

我在这里添加我的包配置:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="MonoAndroid60" />
  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="MonoAndroid60" />
  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="MonoAndroid60" />
  <package id="modernhttpclient" version="2.4.2" targetFramework="MonoAndroid60" />
  <package id="MvvmCross" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Binding" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Core" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Shared" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Support.Core.UI" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Support.Core.Utils" version="4.4.1" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Support.Fragment" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Support.V4" version="4.4.1" targetFramework="monoandroid70" />
  <package id="MvvmCross.Droid.Support.V7.AppCompat" version="4.4.0" targetFramework="monoandroid70" />
  <package id="MvvmCross.Platform" version="4.4.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Compat" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Core.UI" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Core.Utils" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Fragment" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Media.Compat" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v4" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v7.AppCompat" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Vector.Drawable" version="25.0.1-rc1" targetFramework="monoandroid70" />
  <package id="Xamarin.Build.Download" version="0.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Analytics" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Analytics.Impl" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Base" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Basement" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Location" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Maps" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Tasks" version="32.961.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Insights" version="1.12.3" targetFramework="MonoAndroid60" />
</packages>

25.0.1-rc1回滚到24.2.1解决了这个问题,但只要25在RC中,我就会担心未来的兼容性。

1 个答案:

答案 0 :(得分:1)

确保在应用初始化中设置一次:

AppCompatDelegate.CompatVectorFromResourcesEnabled = true;