linux下Android打包环境搭建
程序员文章站
2022-07-02 11:54:21
linux下Android打包环境搭建1. 所需软件安装包jdk安装包下载:链接:https://pan.baidu.com/s/1aUZyK3wfMmzB3g8wihUcEQ 提取码:0sdf fullter安装包下载链接:https://pan.baidu.com/s/1exH3-ibS5AaliB8tf2eRxw 提取码:om41 gradle安装包下载wget https://downloads.gradle-dn.com/distributions/gradle-5.6.4-...
linux下Android打包环境搭建
1. 所需软件安装包
jdk安装包下载:
链接:https://pan.baidu.com/s/1aUZyK3wfMmzB3g8wihUcEQ
提取码:0sdf
fullter安装包下载
链接:https://pan.baidu.com/s/1exH3-ibS5AaliB8tf2eRxw
提取码:om41
gradle安装包下载
wget https://downloads.gradle-dn.com/distributions/gradle-5.6.4-all.zip
SDK下载安装
链接:https://pan.baidu.com/s/1rRod594rKzre5y0zrZo3Jg
提取码:85xu
2. 安装jdk
下载jdk安装包到/usr/local/
cd /usr/local/
tar zxvf jdk-8u191-linux-x64.tar.gz
3. 安装git
yum -y install git unzip zip
#下载版本过低不支持,需要升级
yum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
yum -y update git
git --version
4. 安装SDK
下载SDK安装包到/usr/local/
cd /usr/local/
unzip commandlinetools-linux-6200805_latest.zip -d /usr/local
mkdir -p /usr/local/sdk
cd /usr/local/cmdline-tools/bin
./sdkmanager --list --sdk_root=/usr/local/sdk #显示可安装包
./sdkmanager --install "platforms;android-29" --sdk_root=/usr/local/sdk #安装android-29
./sdkmanager --install "platform-tools" --sdk_root=/usr/local/sdk #安装platform-tools
./sdkmanager --install "build-tools;29.0.3" --sdk_root=/usr/local/sdk #安装build-tools
./sdkmanager --install "cmdline-tools;latest" --sdk_root=/usr/local/sdk #安装cmdline-tools
5. 安装flutter
cd /usr/local
git clone https://github.com/flutter/flutter.git -b stable
6. 安装gradle
cd /usr/local
wget https://downloads.gradle-dn.com/distributions/gradle-5.6.4-all.zip
unzip gradle-5.6.4-all.zipvim
7. 添加环境变量
vim /etc/profile
添加
export JAVA_HOME=/usr/local/jdk1.8.0_191
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export ANDROID_HOME=/usr/local/sdk
export FLUTTER_HOME=/usr/local/flutter
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export GRADLE_HOME=/usr/local/gradle-5.6.4
export PATH=$PATH:$GRADLE_HOME/binPATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${ANDROID_HOME}/build-tools/29.0.3:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${FLUTTER_HOME}/bin:${PATH}
重置环境变量
source /etc/profile
8. 验证环境
java -version
sdkmanager --version
gradle -version
9. 更新SDK
flutter doctor --android-licenses
9. 创建一个工程
mkdir -p /opt/project/demo
cd /opt/project
fullter create demo
10. flutter框架Android打包成apk
cd /opt/project/demo
flutter build apk
11. 正常Android工程打包apk
#例如网上下载一工程test_android
cd test_android
./gradlew :easy-preference:assembleRelease
gradle assembleRelease
本文地址:https://blog.csdn.net/weixin_40668374/article/details/110529948
上一篇: 古代打仗第一排士兵伤亡那么大 士兵为什么还选择冲锋
下一篇: 冰箱温度怎么调?调的时候需要注意什么?
推荐阅读
-
eclipse搭建android开发环境详细步骤
-
centos下GitLab+Jenkins持续集成环境搭建(安装jenkins)
-
在Linux下搭建Zookeeper管理中心步骤分享
-
Android开发环境搭建图文教程 亲测有效!
-
Java入门——在Linux环境下安装JDK并配置环境变量
-
再整理:Visual Studio Code(vscode)下的通用C语言环境搭建
-
Win8.1系统下搭建IIS8.5+PHP5.5.4运行环境教程
-
解决linux环境下时区无法设置的问题
-
JDK Android_SDK Android_Studio Genymotion VirtualBox搭建安卓开发环境
-
详解mac下通过docker搭建LEMP环境