Closed dbsxdbsx closed 3 months ago
frb v2 uses Cargokit by default, and it should work without any extra configuration (indeed the CI has such test IIRC and it works well). I guess your question is not related to frb core, but related to Cargokit, thus it would be great to ask there.
I guess your question is not related to frb core, but related to Cargokit,
But what I tested is almost the new frb project initialized by command flutter_rust_bridge_codegen create my_app
, I only added little things for the Cargo.toml
:
[package]
name = "rust_lib_tst_frb"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "staticlib"]
[profile.release]
lto = true
codegen-units = 1
strip = "debuginfo"
[profile.dev.package."*"]
opt-level = 3
[dev-dependencies]
[dependencies]
flutter_rust_bridge = "2.2.0"
Indeed, I did got similar issue before which is due to some rust crate not compatible for Android, but this times it seems not to due to this reason.
I forgot to mention that, it is a run time panic issue:
I only added little things for the Cargo.toml
Have you tried to create a blank project without any modifications - does it work or not?
Oh I checked the error logs
SEVERE: Warning: An error occurred while preparing SDK package NDK (Side by side) 23.1.7779620: Error on ZipFile unknown archive.
Looks like something related to NDK setup, maybe google such errors and see whether there are some solutions
I only added little things for the Cargo.toml
Have you tried to create a blank project without any modifications - does it work or not?
Not worked, just as what I mentioned. But maybe you are right for that it is related to cargokit, which deals NDK automatically.
My Dart SDK version: 3.5.0 and Rust is 1.80.0.
Now this issue is worked around by manually installing NDK 23.1.7779620
from Android Studio, though I don't know why cargokit would insist on installing this version when there is an upper version already installed.
I don't know as well... Reporting this to cargokit may be helpful.
this line #L63
public final String ndkVersion = "23.1.7779620"
You can specify the version of NDK instead of using the default NDK version of the Flutter tool.
android/app/build.gradle
...
android {
...
compileSdk = flutter.compileSdkVersion
// ndkVersion = flutter.ndkVersion
ndkVersion = "26.1.10909125"
...
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Issue
With frb v2.2.0, I inited a new frb project following https://cjycode.com/flutter_rust_bridge/quickstart, The new project is ok fro building for windows, but for android, it failed with
after
flutter run
.I guess it is somewhat related to the android config file
android\app\build.gradle
with default content:And from the log, it is easy to see that it is issued with
NDK (Side by side) 23.1
, while I did install NDK and put the NDK path inC:\Users\Administrator\.gradle\gradle.properties
with contentANDROID_NDK=C:\Users\Administrator\AppData\Local\Android\Sdk\ndk
. And in this path, the NDK 27.0.12077973 is already installed. So I now strongly suspect that this compiling failed issue is due to the wrong config for the defaultbuild.gradle
content. And after checking doc, I still don't know how to integrate what it said into the defaultbuild.gradle
.What I want
For Frb v2, I hope the default built
build.gradle
could be refined so that the issue won't occur. And I hope the doc for the Android config could be refined so that users won't be at a loss--- currently, except for the one built defaultly, and the template one are different. And I've also checked otherbuild.gradle
from other users, they are usually different, by which at least puts me at a loss.