CentOS7配置Android打包环境

  • 安装android sdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip

echo "export ANDROID_HOME=/data/android" >> /etc/profile
echo "export PATH=\$PATH:\$ANDROID_HOME/tools:\$ANDROID_HOME/tools/bin:\$ANDROID_HOME/platform" >> /etc/profile
source /etc/profile

android -h
android list sdk --all

sdkmanager --list
sdkmanager "build-tools;26.0.0"
sdkmanager platform-tools
sdkmanager --list
mv platform-tools platform
  • 安装flutter框架

wget https://storage.flutter-io.cn/flutter_infra/releases/stable/linux/flutter_linux_1.20.4-stable.tar.xz
xz -d flutter_linux_1.20.4-stable.tar.xz
tar -xvf flutter_linux_1.20.4-stable.tar

echo "export PATH=/data/android/flutter/bin" >> /etc/profile

运行以下命令以查看是否还有缺失的依赖需要安装,你需要安装这些依赖以完成设置(要看到详细输出,请添加 -v 标识)

flutter doctor
  • 打包测试
git clone [gitlab_project_url]
cd [project]
flutter build apk
  • jenkins构建脚本
#!/bin/bash
source /etc/profile
cd /root/.jenkins/workspace/edm-mobile-158
flutter build apk

#obsutil cp build/app/outputs/flutter-apk/app-release.apk obs://

你可能感兴趣的:(android-sdk,jenkins,打包apk,android)