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

news2024/11/29 10:54:37

背景

本文记录不是安卓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 PyYAML
 pip3 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:$PATH

export 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-r25


sdk.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 branch
  master
* 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_code
    exec(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 _main
    default_pip=args.default_pip,
  File "/home/admin/Android_install/Python-3.7.10/Lib/ensurepip/__init__.py", line 127, in _bootstrap
    return _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_pip
    runpy.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_module
    mod_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_details
    return _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.SdkManagerCli
        java.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.2
           platforms;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.2
           platforms;android-33 Android SDK Platform 33
        To 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.html
        
        Using 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.org

Deprecated 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_warnings

BUILD 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.org

Deprecated 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_warnings

BUILD 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.org

Deprecated 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_warnings

BUILD FAILED in 7s



1.11 清理缓存时打包时有正在进行中的任务It is currently in use by another Gradle instance
  • 报错详情:

[admin@localhost ramdisk]$ ./bloodeye/gradlew --no-build-cache -p bloodeye clean


FAILURE: 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: 10592
        Our PID: 31761
        Owner Operation: 
        Our operation: 
        Lock file: /home/admin/.gradle/caches/journal-1/journal-1.lock


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.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 symbol
        if (!LMScreenRecordService.bind(this, conn, R.drawable.notification_logo, name, content, true)) {
             ^
  symbol:   variable LMScreenRecordService
  location: class UpLiveActivity
/home/admin/ramdisk/bloodeye/livemesdk/src/main/java/com/app/live/activity/UpLiveActivity.java:4202: error: cannot find symbol
                LMScreenRecordService.unbind(this, mRecordConnection);
                ^
  symbol:   variable LMScreenRecordService
  location: 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.coloradmin.cn/o/2227235.html

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

相关文章

模型融合新趋势!Transformer领域专家纷纷布局,高分成果轻松达成!

今天给大家分享一个能发A会且不卷的方向&#xff1a;模型融合&#xff01; 光是ICLR2025的投稿&#xff0c;其增长就跃升至前30&#xff0c;可见热度很高&#xff01;但相比其他领域&#xff0c;总量还不大&#xff0c;相对蓝海&#xff0c;创新空间很大。 其所以这么热门&am…

1.机器人抓取与操作介绍-深蓝学院

介绍 操作任务 操作 • Insertion • Pushing and sliding • 其它操作任务 抓取 • 两指&#xff08;平行夹爪&#xff09;抓取 • 灵巧手抓取 7轴 Franka 对应人的手臂 6轴 UR构型去掉一个自由度 课程大纲 Robotic Manipulation 操作 • Robotic manipulation refers…

spark豆瓣书籍推荐系统-计算机毕业设计源码53447

摘要 本论文主要论述了如何基于Spark开发一个豆瓣书籍推荐系统&#xff0c;本系统将严格按照软件开发流程进行各个阶段的工作&#xff0c;面向对象编程思想进行项目开发。在引言中&#xff0c;作者将论述豆瓣书籍推荐系统的当前背景以及系统开发的目的&#xff0c;后续章节将严…

macOS开发环境配置与应用开发教程

macOS开发环境配置与应用开发教程 引言 macOS是一个强大的操作系统&#xff0c;广泛应用于软件开发&#xff0c;尤其是iOS和macOS应用开发。本文将详细介绍如何配置macOS开发环境&#xff0c;并通过实例演示如何进行应用开发。希望通过这篇文章&#xff0c;帮助读者快速上手m…

Unity吃鸡背包系统笔记

功能需求 查看玩家拥有的所有物品&#xff0c;可以放下其中的任意物品&#xff1b;查看已死的他人背包的物品&#xff0c;可以拿起其中的任意物品&#xff1b;查看附近的物品&#xff0c;可以拿起其中的任意物品&#xff08;暂时不考虑背包容量&#xff09;&#xff1b; 难点 …

《Linux系统编程篇》fork函数——基础篇

文章目录 引言fork() 函数概述父子进程 fork函数fork() 的常见问题fork() 的优势与限制 结论 命为志存。 —— 朱熹 引言 《Linux系统编程篇》——基础篇首页传送门 本节我们正式进入Linux的进程代码编写。 fork() 是 Unix 系统中一个重要的系统调用&#xff0c;用于创建一个…

MySQL 8 下载与安装攻略

MySQL是一个流行的关系型数据库管理系统&#xff0c;目前MySQL属于Oracle公司的&#xff0c;关于MySQL的详细介绍可以参考&#xff1a; MySQL 的完整介绍 本篇主要关注MySQL 的下载和安装。 MySQL 下载 官方下载 进入MySQL 的下载页面 &#xff1a;https://dev.mysql.com/do…

HarmonyOS 鸿蒙开发 路由跳转报错this uri is empty, not support in route push.

检查方案1&#xff1a; 工程目录下 entry > src > main > resources > base > profile > main_pages.json中检查是否配置了NextPage 检查方案2&#xff1a; 在路由跳转的代码中检查是否路径配置错误 这里要注意&#xff0c;url的路径一定要和main_pages.json…

芯片上音频相关的验证

通常芯片设计公司&#xff08;比如QUALCOMM&#xff09;把芯片设计好后交由芯片制造商&#xff08;比如台积电&#xff09;去生产&#xff0c;俗称流片。芯片设计公司由ASIC部门负责设计芯片。ASIC设计的芯片只有经过充分的验证&#xff08;这里说的验证是FPGA&#xff08;现场…

【VSCode】配置

安装插件 C vscode-icons gdb调试 https://www.bilibili.com/video/BV15U4y1x7b2/?spm_id_from333.999.0.0&vd_sourcedf0ce73d9b9b61e6d4771898f1441f7f https://www.bilibili.com/video/BV1pU4y1W74Z?spm_id_from333.788.recommend_more_video.-1&vd_sourcedf0…

springboot使用枚举作为接口的参数

1.定义枚举类 2.定义接口 3.具体实现方法 4.apifox传入参数 枚举的具体’名称’就可以了 5.调试 6.进入断点&#xff0c;这样我们发现在接口的参数就映射到应的枚举类上了

数据结构(8.4_3)——堆的插入删除

在堆中插入新元素 在堆中删除元素 总结&#xff1a;

《计算机网络网络层:连接虚拟世界的关键桥梁》

一、网络层概述 网络层在计算机网络中占据着至关重要的地位&#xff0c;它作为连接不同网络的关键层次&#xff0c;起着承上启下的作用。网络层的主要任务是实现网络互连&#xff0c;将数据设法从源端经过若干个中间节点传送到目的端&#xff0c;为分组交换网上的不同主机提供通…

【linux】fdisk磁盘分区管理

介绍 fdisk是一个磁盘分区管理工具&#xff0c;可以用来创建、删除、修改和查看磁盘分区。 fdisk一般都是交互式使用&#xff0c;基础语法: fdisk /dev/sdd。进入交互窗口后&#xff0c;有一些选项&#xff0c;需要了解下&#xff1a; 选项含义n创建新分区p查看磁盘的分区情…

项目成本管理系统有哪些功能?9款工具详解

本文推荐的9大主流项目成本管理工具有: 1. PingCode&#xff1b;2. Worktile&#xff1b;3. 用友U8项目管理&#xff1b;4. 金蝶K3 Cloud&#xff1b;5. 泛微e-Project&#xff1b;6. 亿方云项目管理&#xff1b; 7. SAP Project System&#xff1b; 8. Trello&#xff1b; 9. …

基于opencv的眼镜试戴系统

对于正在准备毕业设计或者想在技术项目上加点“创新”的同学们&#xff0c;推荐一款基于OpenCV的眼镜试戴系统&#xff01;这不仅是一个实现个人创意的项目&#xff0c;更是一个结合AI技术和实用应用的完美范例。 &#x1f31f; 系统核心功能&#xff1a; 图片试戴&#xff1a…

解决cuda环境使用dgl

Dgl 是实现图结构数据构造的工具包&#xff0c;想在gpu环境下使用它&#xff0c;如果安装的是pip install dgl 会有下面错误 dgl._ffi.base.DGLError: [09:10:13] /opt/dgl/src/runtime/c_runtime_api.cc:82: Check failed: allow_missing: Device API cuda is not enabled. P…

软考高级备考记录

一 报考条件和报名流程 报考条件 该考试具有水平考试性质&#xff0c;报考任何级别不需要学历、资历条件&#xff0c;只要达到相应的专业技术水平就可以报考相应的级别 报名流程 软考报名官网&#xff1a;中国计算机技术职业资格网 官网上有 报名时间&#xff0c;考试…

springboot077基于SpringBoot的汽车票网上预订系统--论文pf(论文+源码)_kaic

汽车票网上预订系统 摘要 随着信息技术在管理上越来越深入而广泛的应用&#xff0c;管理信息系统的实施在技术上已逐步成熟。本文介绍了汽车票网上预订系统的开发全过程。通过分析汽车票网上预订系统管理的不足&#xff0c;创建了一个计算机管理汽车票网上预订系统的方案。文章…

vue使用xlsx以及file-saver进行下载xlsx文件以及Unit8Array、ArrayBuffer、charCodeAt的使用

先说Unit8Array、ArrayBuffer、charCodeAt的使用下面会用到这三个 Unit8Array&#xff1a;数组类型表示一个 8 位无符号整型数组&#xff0c;创建时内容被初始化为 0。创建完后&#xff0c;可以以对象的方式或使用数组下标索引的方式引用数组中的元素。 new Uint8Array(); //…