I am trying to write a plugin to connect Flutter to a 3rd party native library which requires AppCompatActivity, however, Flutter seems to either not like it or I am doing something wrong, which given I know almost nothing about native code is quite possible.
I am getting the following error:
(18394): java.lang.IllegalStateException: System services not available to Activities before onCreate()
(18394): at android.app.Activity.getSystemService(Activity.java:7052)
(18394): at android.view.LayoutInflater.from(LayoutInflater.java:288)
(18394): at androidx.appcompat.app.AppCompatDelegateImpl.installViewFactory(AppCompatDelegateImpl.java:1585)
(18394): at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:113)
After searching around it seems at least part of the resolution may lie in adding this snippet to my AndroidManifest.xml
<activity
android:name="com.tap.plugin_wizzitdigital"
android:theme="@style/AppTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
/>
I also tried swapping out for Flutters own FlutterActivity which did not work as specific methods from AppCompatActivity are being called by the native package.
I am guessing there is a way to get this working, at least I hope so, but my GoogleFu is failing me in this case.