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

Android crash: IllegalArgumentException: path must be convex #10235

Closed
3 tasks done
felixkrautschuk opened this issue Mar 14, 2023 · 2 comments · Fixed by #10238
Closed
3 tasks done

Android crash: IllegalArgumentException: path must be convex #10235

felixkrautschuk opened this issue Mar 14, 2023 · 2 comments · Fixed by #10238
Labels

Comments

@felixkrautschuk
Copy link
Contributor

Issue Description

We notice that our Android apps are consistently crashing when using @nativescript/core 8.4.8-next
(we had to install one of the next versions to fix the following issue in our live apps: #10213)

It seems to be related to adding a border to any view, like a button.
We provided a sample app for reproduction (see below) and it has the following layout:


<Page>
    <ActionBar title="My App"/>

    <StackLayout class="p-20">
        <Button text="TAP" tap="onButtonTap" class="-primary" borderRadius="20"/>
    </StackLayout>
</Page>
import {Frame} from "@nativescript/core";

export function onButtonTap() {
  Frame.topmost().navigate("test-page");
}

On our side, the crash is only reproducable on Android 9 emulator and older versions, it does not occur on Android 10 or higher on our side.
Sometimes the app crashes when tapping the button and navigate to another page, sometimes it already crashes when loading the first page with that button.

We see lots of crashes in Crashlytics like this:

System.err: An uncaught Exception occurred on "main" thread.
System.err: path must be convex
System.err:
System.err: StackTrace:
System.err: java.lang.IllegalArgumentException: path must be convex
System.err: at android.graphics.Outline.setConvexPath(Outline.java:284)
System.err: at org.nativescript.widgets.BorderDrawable.getOutline(BorderDrawable.java:914)
System.err: at android.view.ViewOutlineProvider$1.getOutline(ViewOutlineProvider.java:38)
System.err: at android.view.View.rebuildOutline(View.java:15788)
System.err: at android.view.View.invalidateDrawable(View.java:20909)
System.err: at android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:453)
System.err: at android.graphics.drawable.Drawable.setVisible(Drawable.java:862)
System.err: at android.view.View.onVisibilityAggregated(View.java:12924)
System.err: at android.view.View.dispatchDetachedFromWindow(View.java:18395)
System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3777)
System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3769)
System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3769)
System.err: at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5359)
System.err: at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5330)
System.err: at android.view.ViewGroup.removeView(ViewGroup.java:5261)
System.err: at androidx.fragment.app.SpecialEffectsController$Operation$State.applyState(SpecialEffectsController.java:470)
System.err: at androidx.fragment.app.DefaultSpecialEffectsController.applyContainerChanges(DefaultSpecialEffectsController.java:844)
System.err: at androidx.fragment.app.DefaultSpecialEffectsController.executeOperations(DefaultSpecialEffectsController.java:130)
System.err: at androidx.fragment.app.SpecialEffectsController.executePendingOperations(SpecialEffectsController.java:306)
System.err: at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1912)
System.err: at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817)
System.err: at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
System.err: at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547)
System.err: at android.os.Handler.handleCallback(Handler.java:873)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:193)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

The crashes happen mostly on Android 9 (but also Android 10, Android 6, ...).

First version with the issue: 8.4.8-next-02-21-2023-4229708015
Last version without the issue: 8.4.8-next-02-20-2023-4218942650

The issue is still existing when using version 8.5.0-alpha.2

Reproduction

ns-android-crash.zip

  • Download and build the app
  • install it on Android 9 Emulator (or Android 8, 7, 6, ...)
  • Tap the button to navgate to another page -> CRASH
Bildschirmaufnahme.2023-03-14.um.11.58.02.mov

Relevant log output (if applicable)

-

Environment

OS: macOS 13.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Shell: /bin/zsh
node: 16.17.0
npm: 8.19.3
nativescript: 8.4.0

# android
java: 11.0.11
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: 14.2/14C18
cocoapods: 1.11.3
python: 2.7.18
python3: 3.10.9
ruby: 2.6.10
platforms: 
  - DriverKit 22.2
  - iOS 16.2
  - macOS 13.1
  - tvOS 16.1
  - watchOS 9.1

Dependencies

"dependencies": {
  "@nativescript/core": "^8.4.8-next-02-21-2023-4229708015",
  "@nativescript/theme": "~3.0.2"
},
"devDependencies": {
  "@nativescript/android": "^8.4.0",
  "@nativescript/webpack": "~5.0.12"
}

Please accept these terms

@felixkrautschuk felixkrautschuk added the bug-pending-triage Reported bug, pending triage to confirm. label Mar 14, 2023
@CatchABus
Copy link
Contributor

CatchABus commented Mar 15, 2023

I think it's related to #10129
@triniwiz Problem might be lying here: https://github.com/NativeScript/NativeScript/blob/main/packages/ui-mobile-base/android/widgets/src/main/java/org/nativescript/widgets/BorderDrawable.java#L908
Fix might be to recreate or reset background path on each execution.
There is also outlineBackgroundPath that's never used.

@rigor789 rigor789 added bug and removed bug-pending-triage Reported bug, pending triage to confirm. labels Mar 15, 2023
triniwiz added a commit that referenced this issue Mar 16, 2023
NathanWalker pushed a commit that referenced this issue Mar 16, 2023
@felixkrautschuk
Copy link
Contributor Author

Thanks @triniwiz @CatchABus !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants