I need to configure CI/CD service of gitlab. So, I created a file .gitlab-ci.yml
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "26"
ANDROID_BUILD_TOOLS: "26.0.2"
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/tools_r${ANDROID_SDK_TOOLS}-linux.zip
- unzip android-sdk.zip
- export ANDROID_HOME=$PWD/
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- export PATH=$PATH:$ANDROID_HOME
- chmod +x ./gradlew
stages:
- build
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
I need only build an artifact in cloud without testing. So, after commit at master, cd pipeline start execution, and fail. It failed all time on downloading an sdk:
.....
Preparing to unpack .../libc6-i386_2.24-11+deb9u1_amd64.deb ...
Unpacking libc6-i386 (2.24-11+deb9u1) ...
Selecting previously unselected package lib32z1.
Preparing to unpack .../lib32z1_1%3a1.2.8.dfsg-5_amd64.deb ...
Unpacking lib32z1 (1:1.2.8.dfsg-5) ...
Selecting previously unselected package lib32gcc1.
Preparing to unpack .../lib32gcc1_1%3a6.3.0-18_amd64.deb ...
Unpacking lib32gcc1 (1:6.3.0-18) ...
Selecting previously unselected package lib32stdc++6.
Preparing to unpack .../lib32stdc++6_6.3.0-18_amd64.deb ...
Unpacking lib32stdc++6 (6.3.0-18) ...
Setting up libc6-i386 (2.24-11+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Setting up lib32z1 (1:1.2.8.dfsg-5) ...
Setting up lib32gcc1 (1:6.3.0-18) ...
Setting up lib32stdc++6 (6.3.0-18) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
$ wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/tools_r${ANDROID_SDK_TOOLS}-linux.zip
ERROR: Job failed: exit code 1
You have no variable ANDROID_SDK_TOOLS as used in the wget, you only have:
ANDROID_BUILD_TOOLS
ANDROID_COMPILE_SDK
The below configuration settings worked for me. It seems that Gitlab has not updated the default .yml file. More details are given in Link
image: openjdk:8-jdk
cache:
paths:
- .m2/
- .gradle/
variables:
ANDROID_COMPILE_SDK: "26"
ANDROID_BUILD_TOOLS: "26.0.2"
ANDROID_SDK_TOOLS: "26.0.2"
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/sdk-tools-linux-3859397.zip
- unzip -q android-sdk.zip -d android-sdk-linux
- mkdir android-sdk-linux/licenses
- printf "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > android-sdk-linux/licenses/android-sdk-license
- android-sdk-linux/tools/bin/sdkmanager --update > update.log
- android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" "build-tools;${ANDROID_BUILD_TOOLS}" "extras;google;m2repository" "extras;android;m2repository" > installPlatform.log
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
stages:
- build
- test
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
unitTests:
stage: test
script:
- ./gradlew test
$ android-sdk-linux/tools/bin/sdkmanager --update > update.log
Warning: File /root/.android/repositories.cfg could not be loaded.
$ android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" "build-tools;${ANDROID_BUILD_TOOLS}" "extras;google;m2repository" "extras;android;m2repository" > installPlatform.log
Warning: File /root/.android/repositories.cfg could not be loaded.
$ export ANDROID_HOME=$PWD/android-sdk-linux
$ export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
$ chmod +x ./gradlew
$ ./gradlew assembleDebug
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
ERROR: Job failed: exit code 1
Related
I am experimenting with GitLab's CI/CD and is figuring out how to generate a signed release APK.
I've read this article here.
and it suggested the following:
- ./gradlew assembleRelease
-Pandroid.injected.signing.store.file=$(pwd)/my.keystore
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD
-Pandroid.injected.signing.key.alias=$KEY_ALIAS
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
and storing the variables at Gitlab CI/CD variables.
But everytime I run the pipeline it always results to this:
* What went wrong:
Execution failed for task ':app:packageRelease'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException:
com.android.ide.common.signing.KeytoolException: Failed to read key key0 from store "/tmp/Lp7GrQLJ/0/XXXXX/sample-android-project/keystore": Keystore was tampered with, or password was incorrect
Can anyone please guide me here? What could I possible be doing wrong?
May this will helps you.
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "27"
ANDROID_BUILD_TOOLS: "27.0.0"
ANDROID_SDK_TOOLS: "24.4.1"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz
- tar --extract --gzip --file=android-sdk.tgz
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- export GRADLE_USER_HOME="$(pwd)/.gradle"
- export ANDROID_HOME="$(pwd)/.android"
- mkdir -p "${ANDROID_HOME}/licenses"
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "${ANDROID_HOME}/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license"
- echo -e "\nd975f751698a77b662f1254ddbeed3901e976f5a" > "${ANDROID_HOME}/licenses/intel-android-extra-license"
#- ./gradlew --parallel --stacktrace --no-daemon build
- chmod +x ./gradlew
stages:
- build
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
This code is for the Debug Build please replace the assembleDebug to assembleRelease in script.
Put it in your project main folder with the name .gitlab-ci.yml.
I have a problem to generate an APK in an android project through GitLab CI every time I run the gradle with the arguments assemble, assembleRelease or assembleDebug I get this error Task 'assemble' not found in root project 'MyProject'.
This is my .gitlab-ci.yml file.
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "27"
ANDROID_BUILD_TOOLS: "27.0.3"
ANDROID_SDK_TOOLS: "25.2.5"
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/tools_r${ANDROID_SDK_TOOLS}-linux.zip
- unzip -q android-sdk.zip -d android-sdk-linux
- mkdir android-sdk-linux/licenses
- printf "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > android-sdk-linux/licenses/android-sdk-license
- printf "84831b9409646a918e30573bab4c9c91346d8abd" > android-sdk-linux/licenses/android-sdk-preview-license
- printf "d975f751698a77b662f1254ddbeed3901e976f5a" > android-sdk-linux/licenses/intel-android-extra-license
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- android-sdk-linux/tools/bin/sdkmanager --update > update.log
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
stages:
- build
build:
stage: build
script:
- ./gradlew assembleRelease --debug
artifacts:
paths:
- app/build/outputs/
only:
- develop
tags:
- docker
When using the command - ./gradlew build --debug instead of - ./gradlew assembleRelease --debug all works but APK is not generated. Could someone help me?
I create an android project in git lab. I'm trying to use pipelines .
The build failed with message
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
How can I accept this licences automatically?
Adding --no-ui --all is not enough (I have already tried to add them!).
I tried all the soluctions presented [here](you need to accept the license agreements and complete) with no success.
Does someone actually managed to make git lab pipelines works for android?
Below my .gitlab-ci.yml file.
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "24"
ANDROID_BUILD_TOOLS: "25.0.3"
ANDROID_SDK_TOOLS: "25.0.3"
before_script:
- export ANDROID_HOME=$PWD/
- export PATH=$PATH:$PWD/
- 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/tools_r${ANDROID_SDK_TOOLS}-linux.zip
- unzip android-sdk.zip
- echo y | tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- chmod +x ./gradlew
stages:
- build
build:
stage: build
script:
- ./gradlew assembleDebug --stacktrace
artifacts:
paths:
- app/build/outputs/
The sdkmanager cli can be used to update sdks/ accept licenses.
To accept all licenses you can run
echo y | tools/bin/sdkmanager --licenses
I finnally resolve the problem using sdkmanager but I had to download the sdk zip instead of the tools zip like the code in my original question.
This is the final code I copied from Nick Petrovsky post on gitlab issue tracker
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "24"
ANDROID_BUILD_TOOLS: "25.0.3"
# ANDROID_SDK_TOOLS: "25.0.3"
ANDROID_SDK_TOOLS_REV: "3859397" # "26.0.1"
before_script:
- mkdir $HOME/.android # For sdkmanager configs
- echo 'count=0' > $HOME/.android/repositories.cfg # Avoid warning
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS_REV}.zip
- mkdir $PWD/android-sdk-linux
- unzip -qq android-sdk.zip -d $PWD/android-sdk-linux
- export ANDROID_HOME=$PWD/android-sdk-linux
- export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle # Remove if you don't need NDK
- export PATH=$PATH:$ANDROID_HOME/platform-tools/:$ANDROID_NDK_HOME
- echo y | $ANDROID_HOME/tools/bin/sdkmanager --update
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'tools'
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'platform-tools'
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'build-tools;'$ANDROID_BUILD_TOOLS
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'platforms;android-'$ANDROID_COMPILE_SDK
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'extras;android;m2repository'
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'extras;google;google_play_services'
- echo y | $ANDROID_HOME/tools/bin/sdkmanager 'extras;google;m2repository'
- chmod +x ./gradlew
At the end I used this gitlab-ci-android docker image
It is faster and cause much less problems:
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- mkdir -p $GRADLE_USER_HOME
- chmod +x ./gradlew
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
test:
stage: test
script:
- ./gradlew check
I have created a CI image for Android, which can be found at https://gitlab.com/mvglasow/android-gitlab-ci.
It is based on what is described at https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, but it has all the Android tools in the image already so you don’t have to install them again for every CI run. Compared to the instructions, the image saves you about 30 seconds per pipeline.
I work in Android Project, I use gitlab.
I config gitlab-ci.yml file and I try to commit my Android Project but i have an issue in the gitLab pipeline.
I migrating my code and i'm trying to build my application but I receive erro below:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
You have not accepted the license agreements of the following SDK components:
[ConstraintLayout for Android 1.0.2, Solver for ConstraintLayout 1.0.2].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2 mins 8.129 secs
ERROR: Job failed: exit code 1
this is my gitlab-ci.yml file
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "25"
ANDROID_BUILD_TOOLS: "25.0.2"
ANDROID_SDK_TOOLS: "24.4.1"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz
- tar --extract --gzip --file=android-sdk.tgz
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
stages:
- build
- test
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
unitTests:
stage: test
script:
- ./gradlew test
functionalTests:
stage: test
script:
- wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
- chmod +x android-wait-for-emulator
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter sys-img-x86-google_apis-${ANDROID_COMPILE_SDK}
- echo no | android-sdk-linux/tools/android create avd -n test -t android-${ANDROID_COMPILE_SDK} --abi google_apis/x86
- android-sdk-linux/tools/emulator64-x86 -avd test -no-window -no-audio &
- android update sdk --no-ui --filter build-tools-25.0.2,android-25,extra-android-m2repository
- ./android-wait-for-emulator
- adb shell input keyevent 82
- ./gradlew cAT
artifacts:
paths:
- app/build/reports/androidTests/
add the following lines to end of before_script section
- export SDK_MANAGER="${ANDROID_HOME}/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME}"
- set +o pipefail
- echo y | ${SDK_MANAGER} --licenses
- set -o pipefail
a full before_script might looks like this
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.3"
ANDROID_SDK_TOOLS: "6609375_latest"
before_script:
- echo ANDROID_COMPILE_SDK ${ANDROID_COMPILE_SDK}
- echo ANDROID_BUILD_TOOLS ${ANDROID_BUILD_TOOLS}
- echo ANDROID_SDK_TOOLS ${ANDROID_SDK_TOOLS}
- 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}.zip
- unzip -d android-sdk-linux android-sdk.zip
- export ANDROID_SDK_ROOT=$PWD/android-sdk-linux
- export SDK_MANAGER="${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT}"
- echo y | ${SDK_MANAGER} "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | ${SDK_MANAGER} "platform-tools" >/dev/null
- echo y | ${SDK_MANAGER} "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools/
- chmod +x ./gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- echo y | ${SDK_MANAGER} --licenses
- set -o pipefail
I'm new to Gitlab CI and I'm trying to use cache in .gitlab-ci.yml file (on Android platform). The gitlab ci works well but everytime I'm pushing code into gitlab, the CI will download all the data to run it again (It's will take about 30 minutues for each run code pushed).
I'm creating the Gitlab CI with method 1 in this tutorial : http://www.greysonparrelli.com/post/setting-up-android-builds-in-gitlab-ci-using-shared-runners/
I'm trying with many solutions on StackOverflow and another results on Google but still cannot cache.
Here is my .gitlab-ci.yml file:
image: openjdk:8-jdk
variables:
ANDROID_TARGET_SDK: "24"
ANDROID_BUILD_TOOLS: "24.0.3"
ANDROID_SDK_TOOLS: "24.4.1"
MAVEN_OPTS: -Dmaven.repo.local=/cache/maven.repository
before_script:
- export GRADLE_USER_HOME=/cache/.gradle
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz
- tar --extract --gzip --file=android-sdk.tgz
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_TARGET_SDK}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
- export ANDROID_HOME=$PWD/android-sdk-linux
- chmod +x ./gradlew
cache:
key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
paths:
- .gradle/
- build/
- .m2/
- $HOME/.gradle/caches/
untracked: true
build:
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
And my result:
Running with gitlab-ci-multi-runner 1.5.2 (76fdacd)
Using Docker executor with image openjdk:8-jdk ...
Pulling docker image openjdk:8-jdk ...
Running on runner-060bf058-project-212-concurrent-0 via gitlab-runner...
Fetching changes...
Removing .gradle/
Removing android-sdk-linux/
Removing android-sdk.tgz
Removing app/build/
Removing build/
HEAD is now at d9b483e text commit here
From my gitlab project here master -> origin/master
Checking out b18798df as master...
Checking cache for build/master...
$ export GRADLE_USER_HOME=/cache/.gradle
$ apt-get --quiet update --yes
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [402 kB]
Get:4 http://deb.debian.org jessie-backports InRelease [166 kB]
Get:5 http://deb.debian.org jessie Release.gpg [2373 B]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:7 http://deb.debian.org jessie Release [148 kB]
Get:8 http://deb.debian.org jessie-backports/main amd64 Packages [959 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 11.0 MB in 22s (485 kB/s)
Reading package lists...
$ apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
Reading package lists...
Building dependency tree...
Reading state information...
unzip is already the newest version.
wget is already the newest version.
Suggested packages:
ncompress tar-scripts
The following NEW packages will be installed:
lib32gcc1 lib32stdc++6 lib32z1 libc6-i386
The following packages will be upgraded:
tar
.....
.....
.....
BUILD SUCCESSFUL
Creating cache build/master...
.gradle/: found 9 matching files
build/: found 4 matching files
WARNING: .m2/: no matching files
WARNING: /root/.gradle/caches/: no matching files
untracked: found 28180 files
Uploading artifacts...
app/build/outputs/: found 7 matching files
Uploading artifacts to coordinator... ok id=643 responseStatus=201 Created token=nGX6FDZD
Build succeeded
How can I do ? Thank you all
# This file is a template, and might need editing before it works on your project.
# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
cache:
untracked: false
key: ${CI_PROJECT_ID}
paths:
- android-sdk-linux
- .m2/
- .gradle/
- android-sdk.zip
- /var/cache/apt/
- android.keystore
- keystore.properties
stages:
- init
- test
- build
downloadAndroidSDK:
stage: init
script:
- KS_PASS=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
- export GRADLE_USER_HOME=$(pwd)/.gradle
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --continue --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -o -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "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/tools/bin/sdkmanager --licenses
- set -o pipefail
- rm -f $CI_PROJECT_DIR/android.keystore
- echo y | keytool -genkeypair -keyalg RSA -ext KeyUsage:critical=digitalSignature -ext ExtendedkeyUsage:critical=codeSigning -dname "ou=Wdes, c=FR" -alias wdes -keypass $KS_PASS -keystore $CI_PROJECT_DIR/android.keystore -storepass $KS_PASS -validity 1 -deststoretype pkcs12
- keytool -list -storepass $KS_PASS -v -keystore $CI_PROJECT_DIR/android.keystore
- echo -e "release.key.alias=wdes\nrelease.key.password=$KS_PASS\nrelease.storeFile=$CI_PROJECT_DIR/android.keystore\nrelease.password=$KS_PASS\n\ndebug.key.alias=wdes\ndebug.key.password=$KS_PASS\ndebug.storeFile=$CI_PROJECT_DIR/android.keystore\ndebug.password=$KS_PASS\n" > keystore.properties
assembleDebug:
stage: build
dependencies: [ 'downloadAndroidSDK' ]
script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
assembleRelease:
stage: build
dependencies: [ 'downloadAndroidSDK' ]
script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
- ./gradlew assembleRelease
artifacts:
paths:
- app/build/outputs/
lintDebug:
stage: test
dependencies: [ 'downloadAndroidSDK' ]
script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
- ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint
lintFiles:
stage: test
dependencies: [ 'downloadAndroidSDK' ]
script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
- ./gradlew ktlint
debugTests:
stage: test
dependencies: [ 'downloadAndroidSDK' ]
script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
- ./gradlew -Pci --console=plain :app:testDebug