Related #10367
On implementing splash screen in Xamarin.Android by setting the theme for activity and loading it as a drawable background in the form of LayerList throws NotFoundExcption on the drawable resource.
Splash Screen Activity is launched
Black Screen and frequent crashes.
No Workaround found.
I'm getting same crash on API Level 19 and AAB, apk works fine. I suspect recent updates to VS\Xamairn.Android broke this.
I already have the workarounds from the past in my .csproj:
<AndroidR8ExtraArguments>--no-tree-shaking</AndroidR8ExtraArguments>
<AndroidAapt2LinkExtraArgs>--no-version-vectors</AndroidAapt2LinkExtraArgs>
Here's the log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{xcom.saplin.xOPS/crc64b967cc1a76f83cb7.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f07005b
FATAL EXCEPTION: main
Process: xcom.saplin.xOPS, PID: 5830
java.lang.RuntimeException: Unable to start activity ComponentInfo{xcom.saplin.xOPS/crc64b967cc1a76f83cb7.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f07005b
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f07005b
at android.content.res.Resources.loadDrawable(Resources.java:2096)
at android.content.res.Resources.getDrawable(Resources.java:700)
at androidx.core.content.ContextCompat.getDrawable()
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable()
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable()
at androidx.appcompat.widget.ResourceManagerInternal.checkVectorDrawableSetup()
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable()
at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable()
at androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown()
at androidx.appcompat.app.AppCompatDelegateImpl.attachToWindow()
at androidx.appcompat.app.AppCompatDelegateImpl.ensureWindow()
at androidx.appcompat.app.AppCompatDelegateImpl.onCreate()
at androidx.appcompat.app.AppCompatActivity.onCreate()
at crc64b967cc1a76f83cb7.MainActivity.n_onCreate(Native Method)
at crc64b967cc1a76f83cb7.MainActivity.onCreate()
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
... 11 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2092)
... 28 more
Switching to preview update channel solved my issue (now on VS for Mac 8.7 and XF 4.6.0.800)
[Update] [Workaround] downgrading to Xamarin.Forms 4.6.0.726 and disabling experimental AndroidX migration combined resolves the issue. The AAPT NotFoundException is not thrown for Xamarin.Android.Support.v7.AppCompat and Xamarin.Android.Support.v4 packages, but persists for the AndroidX migrated versions.
Seems to be related with #10367.
Seems to be related with #10367.
Yes exactly, mentioned at the top as well, only difference was there weren't any conflicts with the progaurd or r8 configs in this case.