doc.rustdesk.com/content/dev/build/android/_index.zh-cn.md

47 lines
1.5 KiB
Markdown
Raw Normal View History

2022-05-12 15:06:38 +02:00
---
2022-05-13 19:56:14 +02:00
title: 安卓
2022-05-12 15:06:38 +02:00
weight: 22
---
2022-05-13 19:56:14 +02:00
{{% notice note %}}
本教程基于**Linux**,假设您**熟悉** [Android NDK](https://developer.android.com/ndk/downloads)、[Rust](https://rustup.rs/) 和 [Flutter](https://flutter.dev/)。 如果你是初学者,可能比较费劲。
{{% /notice %}}
## 构建 Rust
```
cd
# For saving your time and our time, we prepared dependent files for you.
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/dep.tar.gz
tar xzf dep.tar.gz
# please use r22b, new NDK has below problem
# https://stackoverflow.com/questions/68873570/how-do-i-fix-ld-error-unable-to-find-library-lgcc-when-cross-compiling-rust
wget https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip
unzip android-ndk-r22b-linux-x86_64.zip
2022-05-20 09:30:54 +02:00
# install ffigen and llvm
2022-06-09 17:08:59 +02:00
dart pub global activate ffigen 5.0.1
# on Ubuntu 18, it is: sudo apt install libclang-9-dev
2022-05-20 09:30:54 +02:00
sudo apt-get install libclang-dev
2022-05-13 19:56:14 +02:00
git clone https://github.com/rustdesk/rustdesk
cd rustdesk
2022-05-16 09:19:45 +02:00
rustup target add aarch64-linux-android
2022-05-20 09:30:54 +02:00
2022-05-13 19:56:14 +02:00
cargo install cargo-ndk
2022-05-20 09:30:54 +02:00
VCPKG_ROOT=$HOME/vcpkg ANDROID_NDK_HOME=$HOME/android-ndk-r22b flutter/ndk_arm64.sh
2022-05-13 19:56:14 +02:00
```
## 构建 Flutter
```
cd flutter
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/so.tar.gz
tar xzf so.tar.gz
cp ../target/aarch64-linux-android/release/liblibrustdesk.so android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
# Run on your android device, not support simulator yet (Please do not ask why).
# Good Luck!
2022-06-09 17:13:11 +02:00
# openjdk 11 required, do not use higher or lower, both has problem
2022-05-13 19:56:14 +02:00
flutter run
```