fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.12k stars 283 forks source link

> @Desdaemon Maybe we should add a bit doc about this scenario in the book? (Maybe a section at http://cjycode.com/flutter_rust_bridge/template/setup_android.html or somewhere else?) #788

Closed dbsxdbsx closed 1 year ago

dbsxdbsx commented 1 year ago
    > @Desdaemon Maybe we should add a bit doc about this scenario in the book? (Maybe a section at http://cjycode.com/flutter_rust_bridge/template/setup_android.html or somewhere else?)

I'm considering making this option the default in the template as well, so maybe when I'm less preoccupied I'll put in the changes.

_Originally posted by @Desdaemon in https://github.com/fzyzcjy/flutter_rust_bridge/issues/405#issuecomment-1102039427_

On win10 and frb v1.49.0, I found it still necessary to manually generate libnative.so for x86 and x86_64, which is used for the android simulator.

~~ In addition, with the simulation of Android TV (1080p)API 25, even with the above library, it still cannot compile successfully, with the error : ~~

adb: failed to install C:\Users\dbsx\Desktop\test_frb\build\app\outputs\flutter-apk\app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
Error launching application on sdk google atv x86.

For this error, I've tried to wipe out data following this, but it still occurred.

fzyzcjy commented 1 year ago

INSTALL_FAILED_INSUFFICIENT_STORAGE

looks like you have insufficient storage?

dbsxdbsx commented 1 year ago

Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]

Ok, for this additional issue, I've solved it by doing just clean and wiping out data following this.

fzyzcjy commented 1 year ago

(Btw the title may needs a change)

dbsxdbsx commented 1 year ago

(Btw the title may needs a change)

The title is generated automatically, you can change it as you like.
By the way, do you know how to generate libnative.so for x86 and x86_64 by default?

fzyzcjy commented 1 year ago

/cc @Desdaemon - he should be quite familiar with this since he wrote that great template

Desdaemon commented 1 year ago

(Btw the title may needs a change)

The title is generated automatically, you can change it as you like.
By the way, do you know how to generate libnative.so for x86 and x86_64 by default?

It should be two more flags to supply to cargo ndk IIRC. It is not by default however, you have to specify each arch to build a dylib for.

dbsxdbsx commented 1 year ago

It should be two more flags to supply to cargo ndk IIRC. It is not by default however, you have to specify each arch to build a dylib for.

I know the whole correct command is like this cargo ndk -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 -o ../android/app/src/main/jniLibs build.

If it is agreed to make it generated for all platform by default. I am happy to pr to make it done, if you have no time. But I need to know where need to change.

fzyzcjy commented 1 year ago

I am wondering whether we should generate those two by default? It will make build time twice slower by default.

dbsxdbsx commented 1 year ago

I am wondering whether we should generate those two by default? It will make build time twice slower by default.

For me, making it by default would just let me know little thing about how frb works when dealing with android and corresponding simulator, and pay more attention on the final project itself.

Still for me, the speed for another 2 generations is not a big deal, but the time to figure out how the android simulator works with frb does.

And I think, to make this more suitable for all users, maybe a custom flag is a good practice.

But at present, I still don't know which part of frb triggers the command cargo ndk ....

fzyzcjy commented 1 year ago

Good idea, maybe make it default, and add sth to doc saying that "...if you feel slow and do not need this, turn off something..."

Desdaemon commented 1 year ago

If it is agreed to make it generated for all platform by default. I am happy to pr to make it done, if you have no time. But I need to know where need to change.

It should be in android/app/build.gradle off the top of my head.

dbsxdbsx commented 1 year ago

If it is agreed to make it generated for all platform by default. I am happy to pr to make it done, if you have no time. But I need to know where need to change.

It should be in android/app/build.gradle off the top of my head.

I found it easy to do so. Therefore, I made a pr:https://github.com/Desdaemon/flutter_rust_bridge_template/pull/23. Maybe document should also be updated in the future.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

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.