mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Android improvements (#105)
* Improve the android demo project * Install missing toolchain for the Android action * Improve Android NDK installation docs Co-authored-by: Maximilian Ammann <max@maxammann.org>
This commit is contained in:
parent
70cf25e0c1
commit
172d64f1b3
@ -8,7 +8,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.demo"
|
applicationId "com.example.demo"
|
||||||
minSdk 30
|
minSdk 21
|
||||||
targetSdk 31
|
targetSdk 31
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -17,7 +17,7 @@ android {
|
|||||||
ndk {
|
ndk {
|
||||||
// Specifies the ABI configurations of your native
|
// Specifies the ABI configurations of your native
|
||||||
// libraries Gradle should build and package with your app.
|
// libraries Gradle should build and package with your app.
|
||||||
abiFilters 'x86_64', 'arm64-v8a'
|
abiFilters 'x86_64', 'x86', 'arm64-v8a'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'org.mozilla.rust-android-gradle.rust-android' version '0.9.2' apply true
|
id 'org.mozilla.rust-android-gradle.rust-android' version '0.9.3' apply true
|
||||||
id 'com.android.library' version '7.0.4' apply true
|
id 'com.android.library' version '7.0.4' apply true
|
||||||
id 'org.jetbrains.kotlin.android' version '1.6.21' apply true
|
id 'org.jetbrains.kotlin.android' version '1.6.21' apply true
|
||||||
}
|
}
|
||||||
@ -9,11 +9,11 @@ apply plugin: 'kotlin-android'
|
|||||||
android {
|
android {
|
||||||
ndkVersion "23.2.8568313"
|
ndkVersion "23.2.8568313"
|
||||||
|
|
||||||
compileSdkVersion 29
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 31
|
||||||
|
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -31,7 +31,7 @@ android {
|
|||||||
|
|
||||||
cargo {
|
cargo {
|
||||||
module = "../../"
|
module = "../../"
|
||||||
targets = ["arm64", "x86_64"]
|
targets = ["arm64", "x86_64", "x86"]
|
||||||
libname = "maplibre_android"
|
libname = "maplibre_android"
|
||||||
targetDirectory = "${module}/../target"
|
targetDirectory = "${module}/../target"
|
||||||
profile = "debug"
|
profile = "debug"
|
||||||
@ -41,24 +41,6 @@ cargo {
|
|||||||
noDefaultBut("foo", "bar")
|
noDefaultBut("foo", "bar")
|
||||||
all()
|
all()
|
||||||
}
|
}
|
||||||
|
|
||||||
def ndkDir = android.ndkDirectory
|
|
||||||
|
|
||||||
exec = { spec, toolchain ->
|
|
||||||
spec.environment("TEST", "test")
|
|
||||||
|
|
||||||
// https://github.com/mozilla/rust-android-gradle/issues/91
|
|
||||||
if (toolchain.target == "x86_64-linux-android") {
|
|
||||||
spec.environment("AR_x86_64-linux-android", "$ndkDir/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar")
|
|
||||||
}
|
|
||||||
if (toolchain.target == "armv7-linux-androideabi") {
|
|
||||||
spec.environment("AR_armv7-linux-androideabi", "$ndkDir/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toolchain.target == "aarch64-linux-android") {
|
|
||||||
spec.environment("AR_aarch64-linux-android", "$ndkDir/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@ -54,11 +54,12 @@ cargo run -p maplibre-demo
|
|||||||
Start by installing the
|
Start by installing the
|
||||||
[Android Studio IDE](https://developer.android.com/studio?gclid=CjwKCAjwj42UBhAAEiwACIhADmF7uHXnEHGnmOgFnjp0Z6n-TnBvutC5faGA89lwouMIXiR6OXK4hBoCq78QAvD_BwE&gclsrc=aw.ds).
|
[Android Studio IDE](https://developer.android.com/studio?gclid=CjwKCAjwj42UBhAAEiwACIhADmF7uHXnEHGnmOgFnjp0Z6n-TnBvutC5faGA89lwouMIXiR6OXK4hBoCq78QAvD_BwE&gclsrc=aw.ds).
|
||||||
|
|
||||||
Make sure the NDK version 23.1.7779620 is installed. The Native Development Kit (NDK) is a set of tools that allows
|
Make sure the NDK is installed. The Native Development Kit (NDK) is a set of tools that allows
|
||||||
you to use C and C++ code with Android.
|
you to use C and C++ code with Android. You have to install manually the version that is used in
|
||||||
|
`./android/gradle/lib/build.gradle`.
|
||||||
|
|
||||||
```
|
```
|
||||||
ANDROID STUDIO -> tools -> SDK manager -> SDK tools -> tick show package details -> ndk (side by side) version 23.1.7779620
|
ANDROID STUDIO -> tools -> SDK manager -> SDK tools -> tick show package details -> ndk (side by side)
|
||||||
```
|
```
|
||||||
|
|
||||||
Open the project within `./android/gradle` and create a new virtual device with the device manager. Minimum SDK version
|
Open the project within `./android/gradle` and create a new virtual device with the device manager. Minimum SDK version
|
||||||
|
|||||||
1
justfile
1
justfile
@ -56,6 +56,7 @@ nightly-toolchain:
|
|||||||
nightly-toolchain-android: nightly-toolchain
|
nightly-toolchain-android: nightly-toolchain
|
||||||
rustup target add --toolchain $NIGHTLY_TOOLCHAIN x86_64-linux-android
|
rustup target add --toolchain $NIGHTLY_TOOLCHAIN x86_64-linux-android
|
||||||
rustup target add --toolchain $NIGHTLY_TOOLCHAIN aarch64-linux-android
|
rustup target add --toolchain $NIGHTLY_TOOLCHAIN aarch64-linux-android
|
||||||
|
rustup target add --toolchain $NIGHTLY_TOOLCHAIN i686-linux-android
|
||||||
|
|
||||||
web-install PROJECT:
|
web-install PROJECT:
|
||||||
cd web/{{PROJECT}} && npm install
|
cd web/{{PROJECT}} && npm install
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user