Open WilliamWatterson86 opened 3 years ago
Update - specifically installing Xamarin.AndroidX.Fragment v1.2.5.4 seems to stop the crash.
Same problem for me
I have a similar error. My Xamarin.Forms has version 5.0.0.2012 and Xamarin.AndroidX.Fragment v1.3.1.
Same here.
I have the same problem! Have the latest Xamarin.Forms 5.0.0.2012 and Xamarin.AndroidX.Fragment 1.3.2 installed @jamesmontemagno why is it closed? too many people have this issue
So, we don't take a dependency on this nuget, Xamarin.Forms does via https://www.nuget.org/packages/Xamarin.AndroidX.Legacy.Support.V4/ so i will transfer the issue there. It looks like that will need to be bumped there.
same here, i look report from appcenter and google play store, many my customer affected. help
androidx.fragment.app.Fragment$4.onFindViewById Java.Lang.IllegalStateException: Fragment FragmentContainer{21084c4} (e687202c-12b0-4c6d-a6b9-f87f17028f31) id=0x1} does not have a view
I probably have the same problem (all nugets are up to date):
java.lang.IllegalStateException:
at androidx.fragment.app.Fragment$4.onFindViewById (Fragment.java:2888)
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:501)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:282)
at androidx.fragment.app.FragmentStore.moveToExpectedState (FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1636)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3112)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:3056)
at androidx.fragment.app.Fragment.performActivityCreated (Fragment.java:2989)
at androidx.fragment.app.FragmentStateManager.activityCreated (FragmentStateManager.java:577)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:285)
at androidx.fragment.app.FragmentStore.moveToExpectedState (FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1636)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3112)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:3056)
at androidx.fragment.app.FragmentController.dispatchActivityCreated (FragmentController.java:251)
at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:473)
at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:210)
at crc643f46942d9dd1fff9.FormsAppCompatActivity.n_onStart (Native Method)
at crc643f46942d9dd1fff9.FormsAppCompatActivity.onStart (FormsAppCompatActivity.java:128)
at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1435)
at android.app.Activity.performStart (Activity.java:8222)
at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3818)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2307)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8506)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Workaround is to just manually install the latest 'Xamarin.AndroidX.Fragment' nuget package.
@jamesmontemagno Even after manually installing the mentioned package, the app keeps crashing on Android 11. What can I do?
Did you install Xamarin.AndroidX.Fragment v1.2.5.4 ? or a newer one? looks like some investigation may need to be done.
I've installed the latest version, 1.3.2. Should I roll back to v1.2.5.4? I don't even know what action in the app precedes the crashes, as I'm unable to reproduce them on emulators. I only get reports from the Play console, all the same as the one I posted above.
Same here, any new infos on this?
I cannot reproduce, but I can see it on Google ARNs
@gogolon earlier someone said rolling back to 1.2.5.4 fixed their issue.
This error occurred for me whenever the app went from the background back into the foreground. OnResume was not even called, it just instantly crashed with this error. Rolled back to 1.2.5.4 only to get this error. I then installed Xamarin.AndroidX.Activity 1.2.2 and Fragment 1.2.5.4 to resolve everything.
I can confirm that the downgrade fixes the issue, thanks @nielsbrg I had to downgrade other dependencies as well. Hope this will get fixed soon.
Same thing here. Can't reproduce myself (debug or release version), but Google console is full of it.
I will try your workaround on my next release.
Confirmed that the workaround above fixed all of my crashes
As a side note: it happened to (random?) devices above Android 9+
Can confirm the issue still persists without downgrading to 1.2.5.4. Is there an estimate for fixing this?
Xamarin.AndroidX.Fragment 1.2.5.4 seems to fix it, but that is a whole 6 versions behind current. Is there any news on a fixed version?
Tested with 1.4.0 and still get same error...
I am able to reproduce with:
adb shell "am kill <PackageName>"
1.2.5.4 has no error.
FYI @DevEddy @xleon @jamesmontemagno
This was i think all the time issue with Xamarin even on Xamarin.Android reported long time a go on SO. https://stackoverflow.com/questions/39068772/xamarin-forms-android-java-lang-illegalstateexception-fragment-does-not-have-a
It is crucial issue indeed. we need to find a solution on this.
d with 1.4.0 and still get same error...
I am able to reproduce with:
I am seeing the error in my appcenter logs but i am not able reproduce with the way you described even without having Xamarin.AndroidX.Fragment installed. I am testing on Android 11 device
any idea how can reproduce and solve this? this is really getting annoying 100s of crashes
any idea how can reproduce and solve this? this is really getting annoying 100s of crashes
Did downgrading the library Xamarin.Android.Fragment to version 1.2.5.4 help you?
@pro777s - yes it did for me
yes but is that a good solution to go so many versions older? because when you try to downgrade Fragment package, it automatically downgrades all related packages. So you need to basically use all AndroidX packages from 1.2.5.4. I don't find this is a good solution.
@EmilAlipiev, I agree with you. I don't understand why there is no reaction from the Xamarin developers.
there is no Xamarin.Android.Fragment installed on my android project, should i new install Xamarin.Android.Fragment 1.2.5.4 can solved this issue?
Normally you don't need it. I also don't have it but for workaround it's claimed that you need to install the older version which makes no sense. It's pretty old and I am afraid that it can cause other issues
Can confirm, installing Xamarin.Android.Fragment 1.2.5.4 fixed a crash in our XF app when changing between dark/light mode. Same exception was occurring and also newer versions of this dependency didn't work. Specifically version 1.2.5.4 must be used to avoid crashing.
Can confirm, installing Xamarin.Android.Fragment 1.2.5.4 fixed a crash in our XF app when changing between dark/light mode. Same exception was occurring and also newer versions of this dependency didn't work. Specifically version 1.2.5.4 must be used to avoid crashing.
which version of xamarin.forms you're used?
which version of xamarin.forms you're used?
5.0.0.2012.
Any updates on this one? i would like to update :)
@Codelisk
It's already has released. See https://github.com/xamarin/Xamarin.Forms/releases/tag/release-5.0.0-sr4
Can anyone confirm that the SR fixes the issues?
@DevEddy
I've been using it for a couple of weeks and have not had any issues.
Also noticed this issue in google develop console. It's one of the main crashes in out app -
Only an issue with the latest version of our app, you can see the crashes come flooding in after the latest release -
There where a lot of change in that release (lots of accessibility work), but most notably was -
4.8.0.1560
to 5.0.0.2012
1.2.4.1
to 1.3.2
@IeuanWalker have you tried Xamarin.Forms 5.0.0.2083? This seems to be the SR4 where the issue should be fixed.
@DevEddy no not yet.
I'll update it for the next release.
It's hard to test any changes as it seams to happen randomly throughout the app
@AntRemo was able to reproduce this issue, maybe you can try it on your side.
Tested with 1.4.0 and still get same error...
I am able to reproduce with:
- Launch App
- Tap Home
- Run
adb shell "am kill <PackageName>"
- Resume app... KABOOM!
1.2.5.4 has no error.
FYI @DevEddy @xleon @jamesmontemagno
Thanks, @DevEddy, missed that one.
Before updating the NuGet, it was crashing following the steps above. And looking in the device log it was the same issue. After updating the NuGet I couldn't get it to crash following the same steps.
So fingers crossed the issue is solved 🤞
I will report back once we release a new version and see whether the number of crashes goes down or not
@IeuanWalker could you share your results in production?
Yeah @IeuanWalker any positive results yet?
@xleon @FunbiOyede
Not really :/
Our testers have 2 devices that can replicate the issue. The best we got was to update XF to the latest version. This prevents it from crashing, by restarting the app, so it is better than before. But ideal they should be returned to the original view.
But for now, that's the best we could do, due to other commitments.
Haven't published a new version to the stores yet, but crash reports should hopefully go down.
Ok. Thanks for your response
I had to update XF to latest due to this and other crashes in Android. Everything looks good on our local testing. I removed manual references to AndroidX packages, leaving the automatic dependencies from XF. Will go to production soon. Wish me luck 😁
@xleon can you share your android.csproj nuget overview (for Android packages)?
<PackageReference Include="AppboyPlatform.AndroidBinding" Version="1.21.1" />
<PackageReference Include="AppsFlyerXamarinBindingAndroid" Version="6.3.2.2" />
<PackageReference Include="Com.Airbnb.Xamarin.Forms.Lottie" Version="4.0.10" />
<PackageReference Include="DryIoc.dll" Version="4.8.1" />
<PackageReference Include="Fody" Version="6.5.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Plugin.CurrentActivity" Version="2.1.0.4" />
<PackageReference Include="Polly" Version="7.2.2" />
<PackageReference Include="ReactiveUI.Fody" Version="16.1.1" />
<PackageReference Include="ReactiveUI.XamForms" Version="16.1.1" />
<PackageReference Include="Rg.Plugins.Popup" Version="2.0.0.12" />
<PackageReference Include="SegmentedControl.FormsPlugin" Version="2.0.1" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="0.2.0.64" />
<PackageReference Include="SQLiteNetExtensions" Version="2.1.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.7.335" />
<PackageReference Include="Xamarin.AndroidX.Biometric" Version="1.1.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
<PackageReference Include="Xamarin.FFImageLoading.Transformations" Version="2.4.11.982" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Firebase.Messaging" Version="121.0.1" />
<PackageReference Include="Xamarin.Forms.GoogleMaps" Version="4.0.0-BETA1" />
<PackageReference Include="Xamarin.Forms.SaveOpenPDFPackage" Version="1.0.0" />
<PackageReference Include="Xamarin.Google.Dagger" Version="2.27.0" />
<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="117.6.0" />
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="3.1.0-beta2" />
@xleon You can remove Plugin.CurrentActivity nuget because Xamarin.Essentials have this functionality. Small tip from me :)
Description
Email.ComposeAsync crashes app with Java.Lang.IllegalStateException: FragmentContainer does not have a view
In my code I have a button that will open the email client with a preselected "To" address.
This is the code I am using. var message = new EmailMessage { To = recipients, }; await Email.ComposeAsync(message);
The call to Email.ComposeAsync looks like it working fine, I get the dialog to choose which email app I want to use, then when I select one, my app in the background crashes with this error. This does not happen with other Xamarin Essentials things like "Share" options when email is selected.
Steps to Reproduce
Expected Behavior
App should remain where it was until the user has finished sending their email
Actual Behavior
App crashes when email app is selected
Basic Information
Version with issue:
Last known good version: Not sure
IDE: VS2019
Platform Target Frameworks:
Android Support Library Version: AndroidX
Nuget Packages: Xamarin.Forms 5.0.0.2012 Xamarin.Essentials: 1.6.1
Affected Devices:
Screenshots
JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) Activity.OnStart () FormsAppCompatActivity.OnStart () D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:417 Activity.n_OnStart (System.IntPtr jnienv, System.IntPtr native__this) (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.23(intptr,intptr) java.lang.IllegalStateException: Fragment FragmentContainer{2ab20f} (753ad94b-2740-4b04-8c2b-8b68181c275e) id=0x7} does not have a view androidx.fragment.app.Fragment$4.onFindViewById Fragment.java:2888 androidx.fragment.app.FragmentStateManager.createView FragmentStateManager.java:501 androidx.fragment.app.FragmentStateManager.moveToExpectedState FragmentStateManager.java:282 androidx.fragment.app.FragmentStore.moveToExpectedState FragmentStore.java:112 androidx.fragment.app.FragmentManager.moveToState FragmentManager.java:1636 androidx.fragment.app.FragmentManager.dispatchStateChange FragmentManager.java:3112 androidx.fragment.app.FragmentManager.dispatchActivityCreated FragmentManager.java:3056 androidx.fragment.app.Fragment.performActivityCreated Fragment.java:2989 androidx.fragment.app.FragmentStateManager.activityCreated FragmentStateManager.java:577 androidx.fragment.app.FragmentStateManager.moveToExpectedState FragmentStateManager.java:285 androidx.fragment.app.FragmentStore.moveToExpectedState FragmentStore.java:112 androidx.fragment.app.FragmentManager.moveToState FragmentManager.java:1636 androidx.fragment.app.FragmentManager.dispatchStateChange FragmentManager.java:3112 androidx.fragment.app.FragmentManager.dispatchActivityCreated FragmentManager.java:3056 androidx.fragment.app.FragmentController.dispatchActivityCreated FragmentController.java:251 androidx.fragment.app.FragmentActivity.onStart FragmentActivity.java:473 androidx.appcompat.app.AppCompatActivity.onStart AppCompatActivity.java:210 crc643f46942d9dd1fff9.FormsAppCompatActivity.n_onStart(Native Method) crc643f46942d9dd1fff9.FormsAppCompatActivity.onStart FormsAppCompatActivity.java:128 android.app.Instrumentation.callActivityOnStart Instrumentation.java:1433 android.app.Activity.performStart Activity.java:7980 android.app.ActivityThread.handleStartActivity ActivityThread.java:3578 android.app.servertransaction.TransactionExecutor.performLifecycleSequence TransactionExecutor.java:221 android.app.servertransaction.TransactionExecutor.cycleToPath TransactionExecutor.java:201 android.app.servertransaction.TransactionExecutor.executeLifecycleState TransactionExecutor.java:173 android.app.servertransaction.TransactionExecutor.execute TransactionExecutor.java:97 android.app.ActivityThread$H.handleMessage ActivityThread.java:2220 android.os.Handler.dispatchMessage Handler.java:107 android.os.Looper.loop Looper.java:237 android.app.ActivityThread.main ActivityThread.java:8016 java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493 com.android.internal.os.ZygoteInit.main ZygoteInit.java:1076
Reproduction Link