I use bitbucket pipeline for build android app but every time i am taking memory limit error.
Error message:
Container 'Build' exceeded memory limit.
Bitbucket yml file:
image: java:8
pipelines:
branches:
feature/*:
- step:
name: BuildApp
caches:
- gradle
- android-sdk
script:
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
- unzip -o -qq android-sdk.zip -d android-sdk
- export ANDROID_HOME="/opt/atlassian/pipelines/agent/build/android-sdk"
- export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"
- yes | sdkmanager "platform-tools"
- yes | sdkmanager "platforms;android-29"
- yes | sdkmanager "build-tools;29.0.2"
- yes | sdkmanager "extras;android;m2repository"
- yes | sdkmanager "extras;google;m2repository"
- yes | sdkmanager "extras;google;instantapps"
- yes | sdkmanager --licenses
- echo "$KEY_BASE64" | base64 --decode > app/$KEY_FILE_PATH
- chmod +x gradlew
- ./gradlew assembleRelease --stacktrace
artifacts:
- app/build/outputs/**
definitions:
caches:
android-sdk: android-sdk
I tried to increase docker memory like this.
definitions:
services:
docker:
memory: 7128
pipelines:
branches:
feature/*:
- step:
name: Build App
size: 2x
This will actually double the build minutes. I want to avoid that.
My gradle properties
kotlin.code.style=official
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
Normally my project build times not short and not small project, using a lot of libraries and feature modules. i don't know how its effect memory.