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

fix: running on android devices but shown me "XCode Scheme must be set to Release to use Shorebird" and apps crashed #2739

Open
MarkZhongsh opened this issue Jan 3, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@MarkZhongsh
Copy link

App ID: 42c91bdd-f4e7-40ac-b273-9c4bbdd63919

I only ran shorebird release android --flutter-version 3.22.3 --artifact apk --build-number 2 and installed the apk, and started app on devices, the app was crashed.

Steps To Reproduce

  1. run shorebird release android --flutter-version 3.22.3 --artifact apk --build-number 2 to build apk
  2. install apk
  3. start app

Run log
libnb com.langya.xiangji.fast V enter native_bridge3_loadLibraryExt /data/app/com.langya.xiangji.fast-P_yxsAycNy0UYilF78CmCg==/lib/arm/libflutter.so, 0, 0x3
11446-11473 libnb com.langya.xiangji.fast V native_bridge3_loadLibraryExt: 0xd5031900
11446-11473 libnb com.langya.xiangji.fast V enter native_bridge2_getTrampoline JNI_OnLoad, trampoline_addr 0xf39f3000
11446-11446 flutter com.langya.xiangji.fast A [FATAL:flutter/shell/common/shorebird/shorebird.cc(93)] Check failed: DartSnapshot::VMSnapshotFromSettings(settings). XCode Scheme must be set to Release to use Shorebird
11446-11446 libc com.langya.xiangji.fast A Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 11446 (ya.xiangji.fast), pid 11446 (ya.xiangji.fast)

@MarkZhongsh MarkZhongsh added the bug Something isn't working label Jan 3, 2025
@bryanoltman
Copy link
Contributor

Based on the release metadata, it looks like you aren't using shorebird severs (you've set the base url to http://xlappx.c7ii.com). If you see this happen while using shorebird servers, please reopen the issue.

@bryanoltman
Copy link
Contributor

(internal link)

@eseidel
Copy link
Contributor

eseidel commented Jan 3, 2025

11446-11446 flutter com.langya.xiangji.fast A [FATAL:flutter/shell/common/shorebird/shorebird.cc(93)] Check failed: DartSnapshot::VMSnapshotFromSettings(settings). XCode Scheme must be set to Release to use Shorebird

means that you're running inside Xcode with the Scheme set to Debug. This can easily happen.
https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project

You just want to change the launch scheme to Release to be able to run from within XCode. Although running from within XCode should only be needed if building your own Shorebird engine.

@eseidel
Copy link
Contributor

eseidel commented Jan 3, 2025

Hmm, but this is an Android build, so that assert shouldn't be involved at all.

@eseidel eseidel reopened this Jan 3, 2025
@eseidel
Copy link
Contributor

eseidel commented Jan 3, 2025

OK, looking at the check again:
https://github.com/shorebirdtech/engine/blob/shorebird/dev/shell/common/shorebird/shorebird.cc#L98-L103
The check is just wrong (our bad) and we can improve it. But what it's saying is we failed to get an AOT snapshot out if the unmodified settings passed down into Shorebird.

What's likely happening is that you're using Flutter Engine APIs manually rather than through Google's auto-generated template? (e.g. using https://api.flutter.dev/javadoc/index.html from your app). That's all fine to do, but in this case I think an invalid path is being passed down into Flutter and happens to be then crashing in Shorebird due to this bogus assert.

@eseidel
Copy link
Contributor

eseidel commented Jan 3, 2025

Leaving this open for us to improve the logging/asserting behavior.

@MarkZhongsh
Copy link
Author

OK, looking at the check again: https://github.com/shorebirdtech/engine/blob/shorebird/dev/shell/common/shorebird/shorebird.cc#L98-L103 The check is just wrong (our bad) and we can improve it. But what it's saying is we failed to get an AOT snapshot out if the unmodified settings passed down into Shorebird.

What's likely happening is that you're using Flutter Engine APIs manually rather than through Google's auto-generated template? (e.g. using https://api.flutter.dev/javadoc/index.html from your app). That's all fine to do, but in this case I think an invalid path is being passed down into Flutter and happens to be then crashing in Shorebird due to this bogus assert.

Sorry for my belated reply. I am using Google's auto-generated template.

@eseidel
Copy link
Contributor

eseidel commented Jan 7, 2025

@bryanoltman can you remove this ASSERT next time you're in this code in the engine? Or at least move it to be iOS only (e.g. move to the iOS hook in points). That won't fix mark's issue, but it will change its behavior to hopefully help reveal what's actually going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants