简体   繁体   English

Gitlab CI - Android Sdk 工具?

[英]Gitlab CI - Android Sdk tools?

I use this Link for add gitlab CI in my android project.我使用此链接在我的 android 项目中添加 gitlab CI。 The CI work but I don't understand this part: CI 工作,但我不明白这部分:

ANDROID_SDK_TOOLS:   "4333796"

In the tutorial, android SDK tool is the last version available.在教程中,android SDK 工具是最后可用的版本。

ANDROID_SDK_TOOLS is a little funny. It's what version of the command line tools we're going to download from the official site. So, that number really just comes from the latest version available there.
Installing packages.

But when click on the link, they send me in android studio download page.但是当点击链接时,他们会在 android 工作室发送给我下载页面。

How can i find the version code to put here?我怎样才能找到放在这里的版本代码? Is it important to change it?改变它很重要吗?

I also tried with sdkmanager.bar --list in SDK > tool > bin directory我还尝试在 SDK > 工具 > bin 目录中使用sdkmanager.bar --list

ERROR: JAVA_HOME is set to an invalid directory: D:\Software\JDK\openjdk-15_windows-x64_bin\jdk-15\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

At the download page you'll find the " Command line tools only " section.在下载页面,您会找到“仅限命令行工具”部分。 The file name ends with the version number.文件名以版本号结尾。 As of now this is: 8092744 (it'll change in the future).目前是: 8092744 (以后会变)。

The name of the download URL and the zipped directory have been changed though, so you'll need to update your ci file accordingly.下载 URL 的名称和压缩目录已更改,因此您需要相应地更新您的 ci 文件。 Using the template in the linked tutorial, the file could look like this (I only build a debug apk, you can add release versions too ofc, just like in the tutorial):使用链接教程中的模板,文件可能如下所示(我只构建调试 apk,您也可以添加发布版本,就像教程中一样):

image: openjdk:8-jdk

variables:
  ANDROID_COMPILE_SDK: "31"
  ANDROID_BUILD_TOOLS: "29.0.2"
  ANDROID_SDK_TOOLS:   "8092744"

before_script:
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
  - unzip -d android-sdk-linux android-sdk.zip
  - echo y | android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux/cmdline-tools/latest/ "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
  - echo y | android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux/cmdline-tools/latest/ "platform-tools" >/dev/null
  - echo y | android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux/cmdline-tools/latest/ "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
  - export ANDROID_HOME=$PWD/android-sdk-linux
  - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
  - chmod +x ./gradlew
  # temporarily disable checking for EPIPE error and use yes to accept all licenses
  - set +o pipefail
  - yes | android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux/cmdline-tools/latest/ --licenses
  - yes | android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=/builds/pauni/lara/android-sdk-linux --licenses
  - set -o pipefail

stages:
  - build

assembleDebug:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM