In the future this may be even more simplified by the fact that rustup could automatically distribute the NDK. If you installed rustup, this is done with rustup target add arm-linux-androideabi. Download the Android SDK and NDK, unzip them somewhere, and export the NDK_HOME and ANDROID_HOME environment variables to point to their content.Now, all you need to do is to compile for Android is: The initial part of the rework has just landed. Announcing cargo-apkĪ few days ago, I started reworking the content of android-rs-glue to make it much easier to use. Now only the only difficult part left was setting up android-rs-glue. But now that the Rustup utility appeared, you can obtain an Android-compatible with just rustup target add arm-linux-androideabi. This would require some steps are not necessarily easy for everyone. One of the difficult part of setting up an Android environment was compiling Rust for Android. Through a weird trick, it would capture the arguments that rustc passed to the linker and instead manually invoke the linker itself, then setup a build directory and run the normal Android package building process. To automate building an apk, you may have heard of the android-rs-glue repository, which Servo uses. An apk is a file that contains the Android application in addition to various resource files and that can be installed then run by an average user. When we talk about developing for Android, what we usually want is an apk or Android package. However when you ask rustc to compile for Android, what it produces is an executable that you can only run through debugging tools. The Rust compiler has been supporting Android for a long time now.
0 Comments
Leave a Reply. |