Skip to content

Android setup documentation #418

Open
@Gibbz

Description

@Gibbz

I'm working on adding this to my android project. The project is using xbuild and slint, which uses and android activity crate ( https://github.com/slint-ui/slint/tree/master/internal/backends/android-activity ).

Ive completed the steps below:

<cd to Projects folder>
git clone https://github.com/deviceplug/jni-utils-rs.git
cd jni-utils-rs
cargo build --features=build-java-support
jar files located in /target/debug/java/libs

cd ..
git clone https://github.com/deviceplug/btleplug.git
cd btleplug/src/droidplug/java
edit build.gradle, comment and replace:
dependencies {
    implementation files('/home/bronson/Projects/jni-utils-rs/target/debug/java/libs/jni-utils-0.1.1-SNAPSHOT.jar')
}
./gradlew build 
btleplug/src/droidplug/java/build/outputs/aar/

This gets step 1 complete, and most of step 2...

A quick overview of the build process:

1  For java, you will need the java portion of [jni-utils-rs](https://github.com/deviceplug/jni-utils-rs) available either in a Maven repository or locally (if locally, you'll need to check out btleplug and change the gradle file).
2.  Either build the java portion of btleplug, in the src/droidplug/java directory, using the included gradle files, and them to a Maven repo, or have the Java portion of your android app point to that as a local implementation.
3.  For Rust, the build should go as normal, though we recommend using cargo-ndk to build. Output the jniLibs and make sure they end up in the right place in your app.

But how do i do step 2? have the Java portion of your android app point to that as a local implementation when slint takes care of this all for me?

Do I need to modify the slint source code to add the btleplug stuff? Or load that through rust?

They have no gradle files, no mainactivity... do I modify the java?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions