【测试平台】打包 子节点android环境配置

背景

本文记录不是安卓Gradle打包,因为我们google play提审,为了规避跟下架包的相似度避免马甲包封号,使用混淆逻辑。

打包环境部署

申请对应虚拟机会有两个账号root和admin,主要避免root账号权限过高造成脚本误操作。这里面问题就是那些步骤需要admin操作,那些是root,因为jenkins配置使用admin账号。

1.安装相关过程中需要用的工具- root 账号

方便直接上传和下载对应的文件

# 安装 lrzsz 和 wget命令
yum -y install lrzsz
yum -y install wget# 安装git
yum install git# 查看git 版本号
[root@bogon admin]# git --version
git version 1.8.3.1# Android 工程打包需要这两个架包
yum install perl-Image-ExifTool
yum install libwebp-tools# 常见md5sum 软连接,jenkinsFile脚本中有使用
[root@bogon admin]# which md5sum
/bin/md5sum
[root@bogon admin]# ln -s /bin/md5sum /usr/local/bin/md5sum# 测试软连接成功
[root@bogon admin]# /usr/local/bin/md5sum --version
md5sum (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Written by Ulrich Drepper, Scott Miller, and David Madore.

2.安装python 3.7和对应的python 第三方架包-root账号

研发工程打包脚本有python2和python3两个逻辑,所以机器配置要支持python2.7(系统默认)和python3.7(手工安装)。

  • python3.7以上版本,安装依赖包:libffi-devel

yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
  • 下载 python3.7.10源码,然后解压

cd /home/admin
wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz
tar -xvzf Python-3.7.10.tgz
  • 进入到 python3.7.9 目录下编译和配置

cd Python-3.7.10# 创建一个空文件夹,存放python3程序
mkdir /usr/local/python3# 编译安装
./configure --prefix=/usr/local/python3 
make && make install# 建立Python3的软连接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3# 检查Python3和pip3
[root@bogon Python-3.7.10]# python3 --version
Python 3.7.10
[root@bogon Python-3.7.10]# pip3 --version
pip 20.1.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)
  • python3.7 安装如下2个python 第三方架包

 # 安装第三方架包pip3 install PyYAMLpip3 install protobuf# 查看安装的第三方架包和版本号
[root@bogon android-sdk]# pip3 list
Package    Version
---------- -------
pip        20.1.1
protobuf   4.24.1
PyYAML     6.0.1
setuptools 47.1.0

3.上传bundletool.jar和apktools.jar

将这两个架包放置在/home/admin目录下即可,odin打包脚本会使用这两个jar。

# 修改名称 [admin@bogon ~]$ mv bundletool-all-1.11.2.jar bundletool.jar

注:将本地文件上传的到虚拟服务器的2种方法

  • 方法一: 使用scp命令

从本地mac scp 对应的jar 到 虚拟服务器

#上传文件 scp /Users/zhangxuekun/Downloads/bundletool-all-1.11.2.jar admin@10.61.153.58:/home/admin

  • 方法二:使用rz命令

使用之前需要在虚拟环境上安装 rz 命令

[root@bogon admin]# yum install lrzsz

然后使用支持rz 和sz 命令的 ssh 程序进行上传。

4.安装 android ndk 架包


[admin@bogon Android_install]$ wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip?hl=zh-cn
[admin@bogon Android_install]$ unzip android-ndk-r25c-linux.zip -d /home/admin/

5.安装JDK11 和 配置Java环境变量-root账号

  • 下载jdk11地址

  • 上传jdk 压缩包到虚拟服务器,并解压

[root@bogon admin]# cd /home/admin
[root@bogon admin]# wget https://objects.githubusercontent.com/github-production-release-asset-2e65be/372924883/901544ca-9d19-45c7-b351-cd8c9b0038a2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230828%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230828T101651Z&X-Amz-Expires=300&X-Amz-Signature=32a249bd1fa1305f16baef12041f5b2fcd961adb886814800a0481563209cf42&X-Amz-SignedHeaders=host&actor_id=75983814&key_id=0&repo_id=372924883&response-content-disposition=attachment%3B%20filename%3DOpenJDK11U-jdk_x64_linux_hotspot_11.0.20_8.tar.gz&response-content-type=application%2Foctet-stream
[root@bogon admin]# tar -zxvf OpenJDK11U-jdk_x64_linux_hotspot_11.0.20_8.tar.gz -C /home/admin
  • 配置java环境变量,也可参见centos7下安装java及环境变量配置技巧icon-default.png?t=O83Ahttps://cloud.tencent.com/developer/article/1720948

[root@bogon jdk-11.0.20+8]# cd /home/admin/jdk-11.0.20+8
[root@bogon jdk-11.0.20+8]# vi /etc/profile 
[root@bogon jdk-11.0.20+8]# source /etc/profile
[root@bogon jdk-11.0.20+8]# java -version
openjdk version "11.0.20" 2023-07-18
OpenJDK Runtime Environment Temurin-11.0.20+8 (build 11.0.20+8)
OpenJDK 64-Bit Server VM Temurin-11.0.20+8 (build 11.0.20+8, mixed mode)
# 在/etc/profile  文件最后面加上如下内容
export JAVA_HOME=/home/admin/jdk-11.0.20+8
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

注:

查看linux系统是32位还是64位的方法:执行shell命令“arch”,显示为x86_64表示当前系统为64位,显示为i386,i486等表示系统是32位的。

6.安装 android sdk 环境(这个步骤非常重要否则后面本地编译各种报错)-root账号

  • 下载cmdline-tools 包icon-default.png?t=O83Ahttps://developer.android.com/studio/

注:不要使用官网的最新版本,跟jdk11不兼容。请下载历史版本

cd /home/admin# 下载cmdline-tools包 历史版本 5.0,最新的版本跟jdk11不兼容
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip[root@bogon admin]# md5sum commandlinetools-linux-7583922_latest.zip 
4c2625877503a4b140a6b7ad98b7d5c1  commandlinetools-linux-7583922_latest.zip

 

  • 安装配置

# 解压cmdline-tools包
[root@bogon admin]# cd /home/admin
[root@bogon admin]# mkdir android-sdk
[root@bogon admin]# unzip commandlinetools-linux-7583922_latest.zip -d /home/admin/android-sdk# 查看对应的解压内容
[root@bogon admin]# cd /home/admin/android-sdk
[root@bogon android-sdk]# cd cmdline-tools/
[root@bogon cmdline-tools]# ll
total 128
-rwxr-xr-x  1 root root 120492 Jan  1  2010 NOTICE.txt
drwxr-xr-x  2 root root    146 Aug 22 17:08 bin
drwxr-xr-x 17 root root   4096 Aug 22 17:08 lib
-rwxr-xr-x  1 root root     86 Jan  1  2010 source.properties# 新建一个文件夹/home/admin/android-sdk/cmdline-tools/lastet
[root@bogon cmdline-tools]# cd /home/admin/android-sdk/cmdline-tools
[root@bogon cmdline-tools]# mkdir lastet# 拷贝文件 到 lastet 目录下
[root@bogon cmdline-tools]# mv bin/ lib/ NOTICE.txt source.properties /home/admin/android-sdk/cmdline-tools/lastet/
[root@bogon cmdline-tools]# ll /home/admin/android-sdk/cmdline-tools/lastet
total 100
-rwxr-xr-x  1 root root 92364 Jan  1  2010 NOTICE.txt
drwxr-xr-x  2 root root   122 Aug 22 17:56 bin
drwxr-xr-x 17 root root  4096 Aug 22 17:56 lib
-rwxr-xr-x  1 root root    84 Jan  1  2010 source.properties# 查看所有的platforms-tools
[root@bogon bin]# cd /home/admin/android-sdk/cmdline-tools/lastet/bin
[root@bogon bin]# ./sdkmanager --list --channel=0# 安装 33相关的版本,打包需要使用到
[root@bogon bin]# ./sdkmanager "build-tools;33.0.2" "platforms;android-33" "sources;android-33"# 配置sdkmanager全局变量PATH
[root@bogon jdk-11.0.20+8]# vi /etc/profile 
[root@bogon jdk-11.0.20+8]# source /etc/profile# 检查sdkmanager是否安装成功以及对应的版本信息
[root@bogon android-sdk]# sdkmanager --sdk_root=/usr/local/androidSdk/ --version
5.0
[root@bogon bin]# sdkmanager --list --channel=0
# 将如下内容添加到/etc/profile 文件的最后面export SDK_HOME=/home/admin/android-sdk
export PATH=${SDK_HOME}/cmdline-tools/lastet/bin:$PATHexport ANDROID_HOME=/home/admin/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools

admin账号 授权/home/admin/android-sdk/

原因:打包会报错没有改文件操作权限

使用 root账号 输入操作

chown -R admin:admin /home/admin/android-sdk/

7.安装 exiftool库

下载解压完即可, 对应的环境变量会在测试工程对应的jenkinsFile里面中使用

cd /home/admin
git clone https://github.com/exiftool/exiftool.git
cd exiftool

8.内存磁盘的挂载-root账号

因为客户端要做特征,所以所有.class 和类名 都需要改名称,需要大量读写操作。我们目前条件都是统一采用虚拟内存当做磁盘使用

研发打包逻辑里面,有部分路径写死的,所以linux机器挂载路径必须是/home/admin/ramdisk

cd /home/admin
mkdir ramdisk
sudo mount -t tmpfs -o size=16384m tmpfs ramdisk

执行完上面的命令以后,会生成一个绿色的 ramdisk 的文件夹

注:

  1. 如果机器重新启动了,需要重新挂载执行mount -t tmpfs -o size=16384m tmpfs ramdisk

  2. 内存磁盘卸载命令如下:(正常情况下不需要使用)

umount ramdisk

9.配置Git & 拉取工程代码 - admin账号

必须要使用admin账号进行配置和拉取代码,否则后面会因为git权限的问题jenkins构建报错。

10.Git拉取安卓客户端工程

手工创建代码固定放的路径,后续jenkins挂在该节点机器也是这个目录

注:Android代码拉取比较慢,可以继续执行后面的环境部署事项

拉取研发代码
mkdir /home/admin/.jenkins
mkdir /home/admin/.jenkins/workspace
cd /home/admin/.jenkins/workspace# 拉取研发代码
git clone 客户端git地址# check out 指定调试分支,找研发要,后面需要先在机器上手工执行打包
git checkout 分支名# 查看当前分支
git branch

手工创建/home/admin/.jenkins/workspace/android/bloodeye/local.properties文件

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Aug 22 15:22:27 CST 2023
sdk.dir=/home/admin/android-sdk
ndk.dir=/home/admin/android-ndk-r25sdk.dir=/home/admin/sdk
ndk.dir=/home/admin/sdk/ndk-bundle

11.【重要】打包机器手工执行打包编译

本地手工打包编译成功,说明Android打包环境配置成功

先手工本地执行,确保整个打包编译环境是通畅的,可以编译apk成功。

  • 将 /home/admin/.jenkins/workspace/live-me-android/bloodeye 目录拷贝到 /home/admin/ramdisk/目录下

① 打包的时候,需要在 /home/admin/ramdisk/ 内打包,否则打包非常慢。人工手工调试打包需要自己拷贝,正常打包的话, 这个步骤打包脚本来完成

② 拷贝过去的 bloodeye目录,需要确保git 切到了指定的打包分支中。


[root@bogon bloodeye]# cd /home/admin/.jenkins/workspace/android# 确认是否切到了指定的打包分支
[root@bogon live-me-android]# git branchmaster
* nujoom_1.5.90_gp_rb# 拷贝 Android工程下的bloodeye整个目录 到 /home/admin/ramdisk/中
[root@bogon bloodeye]# cd /home/admin/.jenkins/workspace/android/bloodeye
[root@bogon bloodeye]# cp -rf /home/admin/.jenkins/workspace/android/bloodeye /home/admin/ramdisk/[root@bogon bloodeye]# ll /home/admin/ramdisk/
total 0
drwxr-xr-x 45 root root 1560 Aug 22 18:18 bloodeye
  • 本地手工打包编译

# 进入到内存挂载磁盘的目录
[root@bogon bloodeye]# cd /home/admin/ramdisk# 执行清理缓存文件
[root@bogon bloodeye]# ./bloodeye/gradlew --no-build-cache -p bloodeye clean# 手工执行打包命令。对应红色标记的字符串,需要问对应研发[root@bogon bloodeye]# ./bloodeye/gradlew --no-build-cache -p bloodeye assemblehertzOuterDebug --stacktrace# 打完包以后,apk存放路径
[root@bogon debug]# pwd
/home/admin/ramdisk/bloodeye/app/build/outputs/apk/hertzOuter/debug
[root@bogon debug]# ll
total 62280
-rw-r--r-- 1 root root 63770147 Aug 22 19:51 bloodeye_1.5.90_15902238_20230822_hertz_outer_debug.apk
-rw-r--r-- 1 root root      432 Aug 22 19:51 output-metadata.json

注:执行 ./bloodeye/gradlew --no-build-cache -p bloodeye clean 命令的结果

执行 ./bloodeye/gradlew --no-build-cache -p bloodeye assemblehertzOuterDebug --stacktrace命令的结果

最后记得把 /home/admin/ramdisk/的所有者赋值给 admin账号

chown -R admin:admin /home/admin/ramdisk/

FQA

1.打包环境部署相关问题

1.1 yum 安装架包报错Failed to set locale, defaulting to C
[root@bogon ~]# yum install -y perl-Image-ExifTool
Failed to set locale, defaulting to C
No package perl-Image-ExifTool available.
Error: Nothing to do

解决方案:

[root@bogon ~]# vi /etc/profile.d/my-custom.lang.sh
[root@bogon ~]# source /etc/profile.d/my-custom.lang.sh

添加内容为:

## US English ##
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_COLLATE=C
export LC_CTYPE=en_US.UTF-8

具体解决方案查看:

https://www.cyberciti.biz/faq/failed-to-set-locale-defaulting-to-c-warning-message-on-centoslinux/

1.2 yum 安装perl-Image-ExifTool 报错
[root@bogon ~]# yum install perl-Image-ExifTool
No package perl-Image-ExifTool available.
Error: Nothing to do

原因:这个错误可能是因为 perl-Image-ExifTool 软件包不在您的软件源中。您可以尝试添加 perl-Image-ExifTool 软件包的软件源并重新安装该软件包。

解决方案:

# 添加软件源
sudo yum install epel-release# 更新软件包列表
sudo yum update# 安装 perl-Image-ExifTool 软件包
sudo yum install perl-Image-ExifTool
1.3 安装python3.7.10 报错
Traceback (most recent call last):File "/home/admin/Android_install/Python-3.7.10/Lib/runpy.py", line 193, in _run_module_as_main"__main__", mod_spec)File "/home/admin/Android_install/Python-3.7.10/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)File "/home/admin/Android_install/Python-3.7.10/Lib/ensurepip/__main__.py", line 5, in <module>sys.exit(ensurepip._main())File "/home/admin/Android_install/Python-3.7.10/Lib/ensurepip/__init__.py", line 214, in _maindefault_pip=args.default_pip,File "/home/admin/Android_install/Python-3.7.10/Lib/ensurepip/__init__.py", line 127, in _bootstrapreturn _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)File "/home/admin/Android_install/Python-3.7.10/Lib/ensurepip/__init__.py", line 32, in _run_piprunpy.run_module("pip", run_name="__main__", alter_sys=True)File "/home/admin/Android_install/Python-3.7.10/Lib/runpy.py", line 201, in run_modulemod_name, mod_spec, code = _get_module_details(mod_name)File "/home/admin/Android_install/Python-3.7.10/Lib/runpy.py", line 142, in _get_module_detailsreturn _get_module_details(pkg_main_name, error)File "/home/admin/Android_install/Python-3.7.10/Lib/runpy.py", line 109, in _get_module_details__import__(pkg_name)
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

原因:

zlib1g-dev 是 Debian/Ubuntu 系统上的软件包名称,而在 CentOS/RHEL 系统上,可以使用 yum 包管理器来安装 zlib 库。您可以使用以下命令来安装 zlib 库:

解决方案

[root@bogon Python-3.7.10]# yum install zlib-devel
1.4 安装python3.7 架包报错HTTPSConnectionPool
[root@bogon admin]#  pip3 install PyYAML
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pyyaml/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pyyaml/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pyyaml/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pyyaml/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pyyaml/
Could not fetch URL https://pypi.org/simple/pyyaml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pyyaml/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement PyYAML (from versions: none)
ERROR: No matching distribution found for PyYAML
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

原因:

这个错误通常是由于缺少 SSL 模块导致的。SSL 模块是 Python 中用于处理加密和安全连接的模块,许多 Python 库和工具都依赖于它。

要解决此错误,您需要安装 SSL 模块。您可以使用适当的包管理器来安装 SSL 模块。

解决方案:如果依然报错建议卸载python3 重新安装

yum install openssl-devel

1.5 安装Android sdk环境,检查sdkmanager是否安装成功时报错
[root@bogon cmdline-tools]# sdkmanager --sdk_root=/usr/local/androidSdk/ --version
Error: LinkageError occurred while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerClijava.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

说明JDK的环境太低了,需要升级。说明官网最新的 commandlinetools 跟jdk11不兼容

但是我们打包需要jdk11,jdk18不支持,所以我们只能降低commandlinetools的版本,使用历史版本

比如 https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip

详情查看:ubuntu配置Android编译环境_guo_zhen_qian的博客-CSDN博客

1.6 安装配置Android sdk环境 运行sdkmanager报错
Error: Could not determine SDK root.
Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk>/cmdline-tools/latest/

解决方案:

# 新建一个文件夹/home/admin/android-sdk/cmdline-tools/lastet
[root@bogon cmdline-tools]# cd /home/admin/android-sdk/cmdline-tools
[root@bogon cmdline-tools]# mkdir lastet# 拷贝文件 到 lastet 目录下
[root@bogon cmdline-tools]# mv bin/ lib/ NOTICE.txt source.properties -t latest/# 查看所有的platforms-tools
[root@bogon bin]# cd /home/admin/android-sdk/cmdline-tools/lastet/bin
[root@bogon bin]# ./sdkmanager --list --channel=0# 安装
[root@bogon bin]# cd /home/admin/android-sdk/cmdline-tools/lastet/bin
[root@bogon bin]# ./sdkmanager "build-tools;33.0.2" "platforms;android-33" "sources;android-33"

1.7 手工清除缓存报错缺少相关Android sdk tools错误
Failed to install the following Android SDK packages as some licences have not been accepted.build-tools;33.0.2 Android SDK Build-Tools 33.0.2platforms;android-33 Android SDK Platform 33

原因:工程里面是33,打包编译环境需要安装33相关的 platforms-tools。如果不太清楚可以报错的时候问研发。

[root@bogon bin]# cd /home/admin/android-sdk/cmdline-tools/lastet/bin
[root@bogon bin]# ./sdkmanager --list --channel=0
[root@bogon bin]# ./sdkmanager "build-tools;33.0.2" "platforms;android-33" "sources;android-33"

安装Android 33相关的 platforms-tools成功,如下截图:

报错详情:


[root@bogon ramdisk]#  ./bloodeye/gradlew --no-build-cache -p bloodeye clean --info
...... 省略部分内容
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
Parsing legacy package: /home/admin/android-sdk/cmdline-tools
Parsing legacy package: /home/admin/android-sdk/cmdline-tools
Checking the license for package Android SDK Build-Tools 33.0.2 in /home/admin/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 33.0.2 not accepted.
Checking the license for package Android SDK Platform 33 in /home/admin/android-sdk/licenses
Warning: License for package Android SDK Platform 33 not accepted.FAILURE: Build failed with an exception.* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:huaweiOuterDebugRuntimeClasspath'.> Could not create task ':app:minifyHertzInnerReleaseWithR8'.> Failed to install the following Android SDK packages as some licences have not been accepted.build-tools;33.0.2 Android SDK Build-Tools 33.0.2platforms;android-33 Android SDK Platform 33To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.htmlUsing Android SDK: /home/admin/android-sdk* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 1s

1.8 手工清除缓存报错缺少ANDROID_SDK_ROOT环境变量
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/admin/ramdisk/bloodeye/local

原因:没有配置 ANDROID_SDK_ROOT环境变量

# 执行命令
[root@localhost admin]# cd /home/admin/jdk-11.0.20+8
[root@bogon jdk-11.0.20+8]# vi /etc/profile 
[root@bogon jdk-11.0.20+8]# source /etc/profile
# 添加如下内容到/etc/profile文件中
export ANDROID_HOME=/home/admin/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools

检查是否手工创建 /home/admin/.jenkins/workspace/live-me-android/bloodeye/local.properties

[admin@localhost bloodeye]$ touch local.properties
[admin@localhost bloodeye]$ vi local.properties
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Aug 22 15:22:27 CST 2023
sdk.dir=/home/admin/android-sdk
ndk.dir=/home/admin/android-ndk-r25c

报错详情:

[root@bogon ramdisk]# ./bloodeye/gradlew --no-build-cache -p bloodeye clean
.... 省略部分内容
FAILURE: Build failed with an exception.* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:huaweiOuterDebugRuntimeClasspath'.> Could not create task ':app:minifyHertzInnerReleaseWithR8'.> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/admin/ramdisk/bloodeye/local.properties'.* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 1s

1.9 报错报错 "The SDK directory is not writable (/home/admin/android-sdk)"

解决办法:

root账号登录 授权admin账号

1.10 手工清除缓存报错:/home/admin/ramdisk/bloodeye/local.properties (No such file or directory)

因为是手工执行,所以需要自己手工创建对应的文件。

[root@bogon bloodeye]# cd /home/admin/ramdisk/bloodeye
[root@bogon bloodeye]# touch /home/admin/ramdisk/bloodeye/local.properties

文件内容如下:

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Aug 22 15:22:27 CST 2023
sdk.dir=/home/admin/android-sdk
ndk.dir=/home/admin/android-ndk-r25c

报错详情:

[root@bogon ramdisk]# ./bloodeye/gradlew --no-build-cache -p bloodeye clean
.... 省略部分内容
> Configure project :livemesdk
livemesdk
WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
WARNING:Using flatDir2 should be avoided because it doesn't support any meta-data formats.
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.FAILURE: Build failed with an exception.* Where:
Script '/home/admin/ramdisk/bloodeye/upload_aar_publish.gradle' line: 161* What went wrong:
A problem occurred evaluating script.
> /home/admin/ramdisk/bloodeye/local.properties (No such file or directory)* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 7s
1.11 清理缓存时打包时有正在进行中的任务It is currently in use by another Gradle instance
  • 报错详情:

[admin@localhost ramdisk]$ ./bloodeye/gradlew --no-build-cache -p bloodeye cleanFAILURE: Build failed with an exception.What went wrong:
Gradle could not start your build.
Cannot create service of type BuildTreeActionExecutor using method LauncherServices$ToolingBuildTreeScopeServices.createActionExecutor() as there is a problem with parameter #1 of type List<BuildActionRunner>.
Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().> Timeout waiting to lock journal cache (/home/admin/.gradle/caches/journal-1). It is currently in use by another Gradle instance.Owner PID: 10592Our PID: 31761Owner Operation: Our operation: Lock file: /home/admin/.gradle/caches/journal-1/journal-1.lockTry:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.Get more help at https://help.gradle.org

  • 排查原因:

先查看其他正在进行中的的任务,获取任务ID

[admin@localhost ramdisk]$ ps -ef | grep gradle

  • 解决办法:

确认有其他正在执行的任务,杀掉进程;如果有多个正在进行的任务,需要全部杀掉之后重新执行清缓存命令

[admin@localhost ramdisk]$ kill -9 16459
[admin@localhost ramdisk]$ ./bloodeye/gradlew --no-build-cache -p bloodeye clean
1.12 打包虚拟机本地打包时报错:Task :livemesdk:compileChasexOuterReleaseJavaWithJavac FAILED
  • 报错详情:

warning: unknown enum constant Mode.LOCAL
/home/admin/ramdisk/bloodeye/livemesdk/src/main/java/com/app/live/activity/UpLiveActivity.java:4189: error: cannot find symbolif (!LMScreenRecordService.bind(this, conn, R.drawable.notification_logo, name, content, true)) {^symbol:   variable LMScreenRecordServicelocation: class UpLiveActivity
/home/admin/ramdisk/bloodeye/livemesdk/src/main/java/com/app/live/activity/UpLiveActivity.java:4202: error: cannot find symbolLMScreenRecordService.unbind(this, mRecordConnection);^symbol:   variable LMScreenRecordServicelocation: class UpLiveActivity
warning: unknown enum constant Mode.LOCAL
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
24 warnings
> Task :livemesdk:compileChasexOuterReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.

  • 排查办法:

① 打包虚拟机上检查代码中引用正常

② 打包虚拟机上手工下载包是正常的

③ 打包虚拟机上Gradle 缓存中程序下载正常

④ 检查git发版分支与最新的分支对比,检查对应报错引用的第三方架包版本是否一致(因为客户端代码在中间有更新,所以对应第三方架包做了版本号的升级)

  • 解决办法:更正版本号与其他分支保持一致

1.13 打包虚拟机本地打包时报错:No space left on devices
  • 报错详情:

  • 原因:

/home/admin/ramdisk的磁盘空间,磁盘空间不足,导致打包失败

  • 排查办法:

① 检查/home/admin/ramdisk的磁盘空间,发现磁盘空间异常

[admin@localhost ramdisk]$cd /home/admin/ramdisk
[admin@localhost ramdisk]$df -h #查看磁盘大小

② 检查/home/admin/.jenkins/workspace/live-me-android目录下bloodeye文件夹的大小,文件大小16G仍异常

[root@localhost live-me-android]# cd /home/admin/.jenkins/workspace/live-me-android
[root@localhost live-me-android]# du -sh bloodeye

③ 检查本地工程代码中bloodeye文件夹的大小,6.05G没有异常

④ 可以确定是虚拟机上的工程上的bloodeye文件夹大小异常(推断原因:可能是研发为了排查打包问题,在对应的本地文件夹中进行了打包编译,所以导致bloodeye文件夹变大,然后我们copy 到了 /home/admin/ramdisk 文件夹中)。解决方案:删除工程代码和挂载文件夹,重新拉取代码及创建挂载文件;再次检查工程文件大小

[root@localhost live-me-android]# cd /home/admin/.jenkins/workspace/live-me-android
[root@localhost live-me-android]# du -sh bloodeye
1.6G        bloodeye

1.14 odin打包失败,提示错误:[BT:1.11.2] Error: File '/home/admin/ramdisk/bloodeye/autoBuild/tools/chasex.keystore' was not found.

报错详情

  • 排查办法:

检查/Users/odin/script/Jenkinsfiles/android-chasex/Jenkinsfile 文件中keystroe 需要与研发给的keystroe一致(有时可以叫xx.key ,有时叫xx.keystroe)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/884059.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

免杀对抗—DLL劫持白加黑隐写分离EDRSyscall-hook

前言 今天讲点比较高端的东西—DLL反射注入&#xff0c;首先什么是DLL文件&#xff0c;简答来说就是程序为了实现某个功能而调用的文件。举个例子&#xff0c;某个代码想要实现某个功能是不是会调用一些封装好的函数&#xff0c;exe同样如此&#xff0c;想要实现某个功能就会调…

uniapp推送配置流程

Dcloud Dcloud注册账号 个推 了解即可 注册个推账号 ios配置流程 需配置含有推送的描述文件以及p8证书 配置推送证书 ios证书配置报技术错误&#xff08;参数错误&#xff09; TeamID-苹果开发者账号唯一的ID 安卓需配置多厂商 小米手机需要配置小米厂商 华为手机则需…

zookeeper全系列学习之分布式锁实现

文章目录 前言一、分布式锁的通用实现思路二、ZK实现分布式锁的思路三、ZK实现分布式锁的编码实现1、核心工具类实现2、测试代码编写线程安全问题复现使用上面封装的ZkLockHelper实现的分布式锁 优点缺点 总结 前言 就像上篇文章zookeeper全系列学习之统一配置获取说的&#x…

Uni-App-02

条件编译 条件编译概念 不同的运行平台终归有些专有的特性&#xff0c;无法实现跨平台完全兼容&#xff0c;例如&#xff1a;微信小程序导航栏右上角的关闭图标。 uni-app提供了一种“条件编译”机制&#xff0c;可以针对特定的平台编译执行特定的代码&#xff0c;否则不执行。…

【ArcGISPro】制作简单的ArcGISPro-AI助手

【python】AI Navigator的使用及搭建本机大模型_anaconda ai navigator-CSDN博客 【Python】AI Navigator对话流式输出_ai大模型流式输出效果(打字效果) python-CSDN博客 【C#】调用本机AI大模型流式返回_怎么实现调用本地大模型时实现流式输出-CSDN博客 【ArcGISPro】宣布推…

springboot 修复 Spring Framework 特定条件下目录遍历漏洞(CVE-2024-38819)

刚解决Spring Framework 特定条件下目录遍历漏洞&#xff08;CVE-2024-38816&#xff09;没几天&#xff0c;又来一个新的&#xff0c;真是哭笑不得啊。 springboot 修复 Spring Framework 特定条件下目录遍历漏洞&#xff08;CVE-2024-38816&#xff09;https://blog.csdn.ne…

可编辑97页PPT | 制造企业数字化转型战略咨询及IT总体规划方案

荐言分享&#xff1a;制造企业数字化转型是当前市场环境下的必然趋势&#xff0c;旨在通过引入先进的信息技术&#xff0c;优化业务流程&#xff0c;提升运营效率&#xff0c;增强客户体验&#xff0c;实现可持续发展。这一转型过程涉及多个方面&#xff0c;需要综合考虑企业战…

计算机视觉中的点算子:从零开始构建

Hey小伙伴们&#xff01;今天我们要聊的是一个非常基础但极其重要的计算机视觉技术——点算子&#xff08;Point Operators&#xff09;。点算子主要用于对图像的每个像素进行独立的处理&#xff0c;比如亮度调整、对比度增强、灰度化等。通过这些简单的操作&#xff0c;我们可…

001-Kotlin界面开发之Jetpack Compose Desktop学习路径

Compose Desktop学习之路 学习过程 理解Kotlin的基本语法 Compose Desktop采用Kotlin构建&#xff0c;因此对Kotlin的基本语法有很好的理解是必不可少的。你可以从官方的Kotlin文档开始。 用一句话概括&#xff0c;Kotlin是一种现代的、静态类型的编程语言&#xff0c;它结合…

小金标认证的头戴式蓝牙,QCY H3 Pro耳机,平价高音质的新选择

我发现如今市面上百元级的头戴式无线耳机都有非常出色的音质表现了&#xff0c;这其中国产品牌的表现尤为亮眼&#xff0c;与入耳式耳机相比&#xff0c;头戴式耳机拥有更大的发音单元和更包裹耳朵的耳罩设计&#xff0c;提供了更舒适稳固的佩戴体验&#xff0c;在音质和降噪效…

方法+数组

1. 方法 1. 什么是方法 方法定义&#xff1a; // []表示可写可不写[public] [static] type name ( [type formal , type formal , ...]){方法体&#xff1b;[return value ;] }[修饰符] 返回值类型 方法名称([参数类型 形参 , 参数类型 形参 ...]){方法体代码;[return 返回值…

大语言模型(LLM)入门级选手初学教程 II

模型架构 5.1 输入编码&#xff1a; i. 词元序列编码 Input Embedding Module ii. 位置编码&#xff08;Position Embedding, PE)&#xff0c;Transformer 的编码器结构本身无法识别序列中元素的顺序。 &#x1d499;&#x1d461; &#x1d497;&#x1d461; &#x1d491…

【深度学习】实验 — 动手实现 GPT【二】:注意力机制、注意力掩码、多头注意力机制

【深度学习】实验 — 动手实现 GPT【二】&#xff1a;注意力机制、多头注意力机制 注意力机制简单示例&#xff1a;单个元素的情况简单示例&#xff1a;计算所有输入词元的注意力权重推广到所有输入序列词元&#xff1a; 注意力掩码代码实现多头注意力测试 注意力机制 简单示例…

数据库(31)——事务

事务 数据库事务&#xff08;Database Transaction&#xff09;是数据库管理系统&#xff08;DBMS&#xff09;中执行的一组逻辑操作单元&#xff0c;这些操作要么全部成功执行&#xff0c;要么全部不执行&#xff0c;以保持数据的一致性和完整性。事务是确保数据可靠性的重要机…

Android 获取OAID

获取OAID 老规矩&#xff0c;直接上&#xff1a; implementation com.huawei.hms:opendevice:6.11.0.300 // 要获取华为vaid 和aaid&#xff0c;还需添加opendevice 依赖implementation(name: oaid_sdk_2.5.0, ext: aar) import android.content.Context; import android.util.…

每日互动基于 Apache DolphinScheduler 从容应对ClickHouse 大数据入库瓶颈

引言 大家好&#xff0c;我叫张琦&#xff0c;来自每日互动&#xff0c;担任大数据平台架构师。今天我将分享我们团队在基于Apache DolphinScheduler实现ClickHouse零压入库过程中的实践经验。 这个实践项目涉及到两个关键组件&#xff1a;Apache DolphinScheduler和ClickHous…

[vulnhub] Brainpan1

https://www.vulnhub.com/entry/brainpan-1,51/ 主机发现端口扫描 使用nmap扫描网段类存活主机 因为靶机是我最后添加的&#xff0c;所以靶机IP是166 nmap -sP 192.168.75.0/24 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-1…

数学建模与优化算法:从基础理论到实际应用

数学建模和优化算法&#xff0c;它们不仅帮助我们理解和描述复杂系统的行为&#xff0c;还能找到系统性能最优化的解决方案。本文将从基础的数学理论出发&#xff0c;逐步深入到各种优化算法&#xff0c;并探讨它们在实际问题中的应用。 思维导图文件可获取&#xff1a;https:…

基于Intel Gaudi AI加速器的大语言模型微调与推理优化赛题等你挑战 | CCF BDCI进行时

一年一度的行业盛事2024 CCF大数据与计算智能大赛&#xff08;简称2024 CCF BDCI&#xff09;又在激烈进行中啦&#xff01; 多个赛题等你挑战还没有报名的伙伴们抓紧时间咯&#xff0c;叫上你伙伴练起来吧&#xff01; 2024 CCF大数据与计算智能大赛 CCF大数据与计算智能大…

使用 FastGPT 工作流搭建 GitHub Issues 自动总结机器人

如今任何项目开发节奏都很快&#xff0c;及时掌握项目动态是很重要滴&#xff0c;GitHub Issues 一般都是开发者和用户反馈问题的主要渠道。 然而&#xff0c;随着 Issue 数量的增加&#xff0c;及时跟进每一个问题会变得越来越困难。 为了解决这个痛点&#xff0c;我们开发了…