This is a wrapper of ArkLib which enables you to build Android apps, powered by resource indexing, previews generation and user metadata support such as tags or scores.
The following information is only for developers. |
Github packages with credentials is a workaround since JCenter is shutdown
Add the following script to project's build.gradle
:
allprojects {
repositories{
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/ARK-Builders/arklib-android"
credentials {
username = "token"
password = "\u0037\u0066\u0066\u0036\u0030\u0039\u0033\u0066\u0032\u0037\u0033\u0036\u0033\u0037\u0064\u0036\u0037\u0066\u0038\u0030\u0034\u0039\u0062\u0030\u0039\u0038\u0039\u0038\u0066\u0034\u0066\u0034\u0031\u0064\u0062\u0033\u0064\u0033\u0038\u0065"
}
}
}
}
And add arklib-android
dependency to app module's build.gradle
:
implementation 'dev.arkbuilders:arklib:0.3.1'
- Rust toolchain
- Kotlin toolchain
- Android SDK + NDK r24 (latest)
You need to have Rust targets installed:
rustup target add armv7-linux-androideabi
rustup target add aarch64-linux-android
rustup target add i686-linux-android
rustup target add x86_64-linux-android
For checking if Rust code compiles without problems, you can use this command:
./gradlew cargoBuild
The above command should generates libarklib.so
file inside ./arklib/target/<arch>/<buildVariant>
folder.
If the build is failed, which leads to no generated .so
files, there's a build alternative
which doesn't require you to install extra dependencies:
https://github.com/bbqsrc/cargo-ndk
Using cargo-ndk
, you can generate the libarklib.so
files in two steps:
- cd arklib
- cargo ndk -o ./jniLibs build
Running the above two commands outputs same .so
files as ./gradlew cargoBuild
does.
Before make a release build, ensure you have set profile = "release"
in cargo config.
./gradlew lib:assemble
The generated release build is lib/build/outputs/aar/lib-release.aar
Ensure you have committed your changes.
./gradlew release
Then simply push to the repo.
Make sure you have switch to debug
profile in cargo config, which could be found at lib/build.gradle
Run the command to build
./gradlew lib:assemble
Connect to a device or setup an AVD and check the functionality.
./gradlew appmock:connectedCheck
Unit tests require native ARK library file for host machine in project root directory.
libarklib.so
for Linuxlibarklib.dylib
for Maclibarklib.dll
for Windows
Unit tests depend on buildRustLibForHost
gradle task (Linux, Mac)
But you can do it manually:
- Find out host architecture
rustc -vV | sed -n 's|host: ||p'
- Change to
arklib
directory and build the librarycargo build --target $host_arch
- Copy library from
arklib/target/$host_arch/debug/libarklib.(so|dylib|dll)
to project root directory
Shortcut for Linux:
ARCH=$(rustc -vV | sed -n 's|host: ||p') cargo build --target $ARCH && cp arklib/target/$ARCH/debug/libarklib.so .