-
Notifications
You must be signed in to change notification settings - Fork 555
Description
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VS 2022 17.8.0 Preview 2
Description
net8.0-android - (no option to choose net8 above) . - Deploying to Pixel 6 - Android 14 beta.
The release version builds ok, it had some build errors, but they were simple to fix. The app starts ok but then fails at run time when I try to open my GoogleSignInFragment with the error below.
If a debug build everything works ok.
If I replace the button click with IView.IOnClickListener in the release build and use the following, the error goes away and I can sign in.
public void OnClick(View? v)
{
...
}
It appears as though, R8 is stripping something away, but I'm not sure how to fix it.
I do have a proguard.cfg which has the following.
-keep class com.google.android.gms.common.SignInButton
-keep class com.google.android.gms.auth.api.signin.GoogleSignInOptions { *; }
-keep class com.google.android.gms.auth.api.signin.internal.SignInHubActivity {*; }
According to my comments, this was added in June 2020, so I'm not sure it is even required now. I now can't remember how I came up with that, but it was crashing back then and the above fixed it.
After I got the GoogleSignInFragment working I then tried the SubscriptionFragment and that also failed with the same error.
Can you please suggest what is required?
Prior to working on this app, I first converted one of my GitHub test apps to net8.0-android and that is working fine, but obviously, that doesn't have any buttons. I could add a button to one of its fragments and upload it there if you need a sample.
Steps to Reproduce
See above
Did you find any workaround?
See above
Relevant log output
Unhandled Exception from source=AndroidEnvironment
Java.Lang.Exception: android.view.View_IOnClickListenerImplementor
at Java.Interop.JniEnvironment.Types.TryFindClass(String , Boolean )
at Java.Interop.JniEnvironment.Types.FindClass(String )
at Java.Interop.JniType..ctor(String )
at Java.Interop.JniPeerMembers.JniInstanceMethods..ctor(Type )
at Java.Interop.JniPeerMembers.JniInstanceMethods.GetConstructorsForType(Type )
at Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance(String , Type , JniArgumentValue* )
at Android.Views.View.IOnClickListenerImplementor..ctor()
at Android.Views.View.__CreateIOnClickListenerImplementor()
at Java.Interop.EventHelper.AddEventHandler[IOnClickListener,IOnClickListenerImplementor](WeakReference& , Func`1 , Action`1 , Action`1 )
at Android.Views.View.add_Click(EventHandler )
at com.glmsoftware.obdnowpros.Fragments.SubscriptionFragment.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState)
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L(_JniMarshal_PPLLL_L callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, IntPtr p1, IntPtr p2)
--- End of managed Java.Lang.Exception stack trace ---