question

RomanPristinsky-1428 avatar image
0 Votes"
RomanPristinsky-1428 asked RomanPristinsky-1428 commented

java.lang.IllegalStateException: FormsAppCompatActivity.n_onStart app exception..

Hi!

I can't figure out why my application is crashing.
I use Xamarin.Forms 5.0.0.2012 and AndroidX libraries.
Here is a complete dump of the error from which I can't figure out what's going on:

java.lang.IllegalStateException:
at androidx.fragment.app.Fragment$4.onFindViewById (Fragment.java:2901)
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:504)
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:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3126)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:3070)
at androidx.fragment.app.Fragment.performActivityCreated (Fragment.java:3002)
at androidx.fragment.app.FragmentStateManager.activityCreated (FragmentStateManager.java:580)
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:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3126)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:3070)
at androidx.fragment.app.FragmentController.dispatchActivityCreated (FragmentController.java:251)
at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:501)
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:1432)
at android.app.Activity.performStart (Activity.java:7923)
at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3359)
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:2068)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:224)
at android.app.ActivityThread.main (ActivityThread.java:7551)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:995)

The crash occurs only on devices with Android 9 and 10 (API level 28 and 29).
The above log was copied from the Google Play console.
During testing, the error does not appear.
Any help?

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

A few days after the distribution of a new build of the application with the library Xamarin.Android.Fragment 1.2.5.4, it can be argued that the problem is gone!

1 Vote 1 ·

1 Answer

JarvanZhang-MSFT avatar image
1 Vote"
JarvanZhang-MSFT answered RomanPristinsky-1428 commented

Hello,​

Welcome to our Microsoft Q&A platform!

Hi, omanPristinsky. Did you install the Xamarin.AndroidX.Fragment package? Try to update the nuget to the lastest stable version for test. If it doesn't work, please try the version 1.2.5.4.

Someone also faced the similar issue and has report the problem to the product team on github. Here are the related links, you could refer to the links and follow the topic for a solution.

https://github.com/xamarin/Essentials/issues/1726
https://github.com/xamarin/Xamarin.Forms/issues/13895#issuecomment-794378682

Best Regards,

Jarvan Zhang



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, arvanZhang-MSFT.
Thanks for your answer.
I seems like I found the problem in my code.
But so far this is not certain. Need to check.

0 Votes 0 ·

Waiting for your update.

0 Votes 0 ·

Thanks again for your advices. I have downgraded the Xamarin.AndroidX.Fragment library to 1.2.5.4 version. I fixed all the errors I found in my code, but the problem still remained. When I have the opportunity, I examine the full log (logcat). But even this is not always able to identify the problem. I wonder if there is some approach to understand what the problem is?

P.S. I noticed that this problem also affected other versions of Android.

0 Votes 0 ·

The above log was copied from the Google Play console. During testing, the error does not appear.

Does the issue only occur in release mode? What are settings about the release? Could you please share some the details about the configuration?

0 Votes 0 ·

Thank you for your participation.
After researching my problem, I was convinced that, indeed, the error is in the library Xamarin.Android.Fragment v1.3.1-1.3.2. So there is no need to provide a config file.
I ran tests on my new build of the program with a downgraded version 1.2.5.4 of the library and so far the errors does not appear. Let's see what will happen next.

0 Votes 0 ·

Congrats! And thanks for updating the details.

0 Votes 0 ·