Desdaemon / flutter_rust_bridge_template

Template for Flutter + Rust integration with flutter_rust_bridge.
https://desdaemon.github.io/flutter_rust_bridge_template/
Apache License 2.0
120 stars 63 forks source link

ring __ANDROID_API__ redefined error #31

Closed mmr1984 closed 1 year ago

mmr1984 commented 1 year ago

This only happens in a flutter_rust_bridge_template project. When you add the ring crate (using the newest 0.16.20) I get the error when running flutter build apk (git clone flutter_rust_bridge; cargo add ring; flutter build apk):

:389:9: error: '__ANDROID_API__' macro redefined [-Werror,-Wmacro-redefined] #define __ANDROID_API__ 21 ^ :381:9: note: previous definition is here #define __ANDROID_API__ __ANDROID_MIN_SDK_VERSION__ ^ 1 error generated. thread 'main' panicked at 'execution failed', /home/marcr/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9 This is only with Android. It compiles for linux. I just don't know what I need to modify to get this working. I have setup the correct toolchain I believe - can compile when ring is not included. I am using NDK 25 (25.1.8937393) Just looking for help, or help in how to go about modifying flutter_rust_bridge_template so I can use ring. It is a needed package for tor and webrtc. Thank you for developing flutter_rust_bridge and providing this template. It has been a huge help! Thanks!! Marc.
Desdaemon commented 1 year ago

I can't provide any library-specific support, but have you checked out briansmith/ring#1519 and similar issues? It seems to be a conflict of the cargo-ndk used.

mmr1984 commented 1 year ago

Thanks - all I had to do was to update cargo-ndk and it fixed it. Thank you for the quick response and for the work you are doing!