Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException since update #293

Closed
DevEddy opened this issue Mar 22, 2021 · 4 comments
Closed

java.lang.IllegalStateException since update #293

DevEddy opened this issue Mar 22, 2021 · 4 comments

Comments

@DevEddy
Copy link

DevEddy commented Mar 22, 2021

Version Information

  • Visual Studio version (eg. 16.8 or 8.8): 16.9.2
  • Xamarin.Android version (eg. 11.1): 11.2.2.1 (dl16-9)
  • Using AndroidX or Support Libraries:
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.2.1" />
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.2.0.7" />
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.5" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.Utils" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.AppCompat.Resources" Version="1.1.0.1" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.7" />
  • If Support Libraries, version (eg 28.0.0): -

Describe your Issue:

After a upgrade of Android X packages a lot of users are experiencing this (see stack trace) kind of crash. I can see it via google "Crashes and ANRS".

Upgraded AndroidX packages:
Xamarin.AndroidX.Palette 1.0.0.6 > 1.0.0.7
Xamarin.AndroidX.Lifecycle.LiveData 2.2.0.4 > 2.3.0.1
Xamarin.Google.Android.Material 1.3.0 > 1.3.0.1
Xamarin.AndroidX.Legacy.Support.V4 1.0.0.6 > 1.0.0.7
Xamarin.AndroidX.MediaRouter 1.2.1 > 1.2.2.1

Steps to Reproduce (with link to sample solution if possible):

I could not reproduce it on the emulator, I am not sure. Seems to happen sporadically on startup of the app.

Edit: It seems it happens only when the app was killed by android before and the user tries to start the app:

app.kill("excessive cpu " + cputimeUsed + " during " + uptimeSince + " dur=" + checkDur + " limit=" + cpuLimit, true);
Source: https://android.googlesource.com/platform/frameworks/base/+/97995da6e1d40a053402cc120944e3738a18d1a0/services/core/java/com/android/server/am/ActivityManagerService.java#24367

Include any relevant Exception Stack traces, build logs, adb logs:

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:1433)
  at android.app.Activity.performStart (Activity.java:7986)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3677)
  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:2267)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8167)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)

ADB Bug Report: bugreport-sdk_gphone_x86-RSR1.201013.001-2021-03-22-14-50-25.zip

@Swodah
Copy link

Swodah commented Nov 26, 2021

I also get a lot of illegalstate exceptions, I was able to reproduce it as simply as putting the app to the background and changing the phone to darkmode then going back into the app. I surmised it had something to do with the app rebuilding a view, though I haven't tested it with other methods(such as rotating the view or otherwise forcing it the rebuild the view)

@Savage1024
Copy link

Savage1024 commented Dec 8, 2021

I think this is the same bug
xamarin/Xamarin.Forms#13895

@nathankim0
Copy link

@jpobst
Copy link
Contributor

jpobst commented May 24, 2022

There isn't really any added logic in the AndroidX binding. It is simply a generated wrapper around Google's androidx.fragment library. Likely, Google changed something about how this package works and Xamarin Forms needs to be updated to accommodate this change.

As there are multiple XF bugs linked already, closing this issue in favor of those bugs.

@jpobst jpobst closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants