Issue
One of the massive projects I am helping with, uses MvvmCross v5.2.1.
When we target the framework Android 10.0 (API Level 29) (Q), as soon as the OnCreate()
lifecycle function of the MainActivity
runs, an exception crash happens on the line SetContentView(Resource.Layout.activity_main)
.
A part of the exception reads
java.lang.NoSuchFieldException: No field mConstructorArgs in class Landroid/view/LayoutInflater; (declaration of 'android.view.LayoutInflater' appears in /system/framework/framework.jar!classes3.dex)
at java.lang.Class.getDeclaredField(Native Method)
at mvvmcross.binding.droid.views.MvxLayoutInflater_PrivateFactoryWrapper2.n_onCreateView(Native Method)
at mvvmcross.binding.droid.views.MvxLayoutInflater_PrivateFactoryWrapper2.onCreateView(MvxLayoutInflater_PrivateFactoryWrapper2.java:32)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:239)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069)
Here's a more detailed log in this pastebin.
It seems identical to this Github issue on the MvvmCross repo: and I followed the links to this pull request.
Does that mean any one using #MVVMCross before v6.4.1, must upgrade if they want to target the framework Android 10.0? Is there any work around?
Solution
I asked the question to the creators and maintainers of the MVVMCross framework on Twitter, as you can see in this thread. I got the following response:
You need 6.4.1. No known workarounds maybe except for copying all the necessary code to fix that layout inflater issue.
This means that the only solution to target the framework Android 10.0 and above is to update to package version 6.4.1 or up. It is a very difficult process, since among other things, it also requires updating the Solution to .NET Core 2.0 Framework.
What does that mean? As of 2019, the Android Play Store only accepts APK files that are targeting framework 8.1. So by November 2020, they are changing the requirement to Android 10.0, by when you will need to update your nuget package as well.
Update: I wrote an article about this as well to raise awareness about this issue, since there's a deadline of November 2020 before which users must target their apps to Android 10.
Update 2: I wrote another article about this to show people step by step how to update their app to the latest MVVMCross
Answered By - Saamer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.