Closed ferencIOS closed 1 year ago
Unfortunately the process is a bit more complicated than that. I know for sure it works because I successfully compiled the project for Android and built a demo app on top of it. I don't have an Apple Silicon (just an Intel one) but I remember I managed to get it working following this https://github.com/mozilla/rust-android-gradle
If I remember correctly I had to adjust a few things, but that was a good start. Mine was just an experiment and I did not go any further than building a simple app using the library, but I can get back to the code if you need further assistance.
Just keep in mind that the library is designed to accept an input file path and to write the compressed file into an output path, which is not really well suited for the Android environment due to OS permissions.
Oh thanks! I will try to follow the guide.
If it should be simple I will write the steps that maybe it will be useful to someone else.
Hi!
Starting from the main
branch here is a patch for android support.
STEPS
android-exp
branch was an inspiration)rust-android-gradle
chapter Usage
as you suggested - rustCaesiumNative.kt
into caesium
package with a compress
fun (as the rust signature Java_com_example_caesium4android_caesium_CaesiumNative_compress
says)package com.example.caesium4android.caesium
import java.lang.System.*
class CaesiumNative {
external fun compress(source: String, destination: String): Boolean
companion object {
init {
loadLibrary("caesium")
}
}
}
Thanks! This is very similar to what I got during my experiments.
I think it's better to have a separate project like libcaesium-android
to keep this repository as clean as possible. I've done something similar with https://github.com/Lymphatus/libcaesium-php for PHP.
I'll try in the next days.
I am trying to compile the lib for Android on MacOS Ventura 13.3.1 - Apple M1.
My idea is to follow the Android Guide, starting from .a files or .java/c files.
First of all I changed the
Cargo.toml
file:Then:
Result:
Thanks for your help!