Nativescript: Crash: View already has a parent on Android 7.0 with Split screen + pageTransitions

Created on 18 Apr 2017  路  5Comments  路  Source: NativeScript/NativeScript

Please, provide the details below:

Did you verify this is a real problem by searching [Stack Overflow]

I can consistently reproduce the problem on my Android 7.0 emulator.

Tell us about the problem

My App crashes on Android 7.0, if I have switched page and open Android 7.0's split screen.

Which platform(s) does your issue occur on?

Android 7.0

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

  1. create an angular project with: tns create hallo-world --ng
  2. set pageTransition="slideTop" on the nsRouterLink-label in app/item/items.component.html
  3. Run the App on an Android 7.0 emulator
  4. Tap an item and tap back
  5. Hold the window-switch-button down until the split-screen comes up.
  6. The App should now have crashed with the "View already has a parent"-error.

I don't know if it's caused by the same problem, but I've seen the error many times. But I haven't been able to reproduce it, making it hard to write a proper bug report on the issue.

android7-crash-view-already-have-parent

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

I've added a test project here:
https://github.com/m-abs/ns-debugging/tree/master/crash-view-already-have-parent

bug done android high

All 5 comments

Argh! So it's not only my app. I've been getting this a lot in the latest release of my app. (Logged in analytics).

Running vanilla NS v2.5.2
Core modules: v2.5.2
Android-runtime: v2.5.0

Didn't have to tap around: just start app, hold the "square" on first view and initiate the split-screen = crash.

Confirming this issue is reproducible with the template Angular app and pageTransition on nsRouterLink.
Test application can be found here.

This is probably related to how Android handles the activities on split screen and after app has been minimized and might be related to this one. In fact, if you set Developer options -> Don't keep activities option ON then the application will crash on split screen but will work on minimize. If the same options is OFF then the application will work on app minimize but will crash on the split mode.

@m-abs, @manijak as a temporary solution in order to avoid the app crashing runtime you can disable the split screen mode for your application. TO do so all you need to do is to provide a false boolean value for android:resizeableActivity key in your AndroidManifest.xml

e.g.

...
<activity
    android:name="com.tns.NativeScriptActivity"
    android:label="@string/title_activity_kimera"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@style/LaunchScreenTheme"
    android:resizeableActivity="false">

@m-abs, @manijak just FYI - this issue is now resolved with NativeScript 3.x.x

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings