Jetpack Compose строит память конвейера gitlabAndroid

Форум для тех, кто программирует под Android
Ответить
Гость
 Jetpack Compose строит память конвейера gitlab

Сообщение Гость »


I'm building an android app using jetpack compose and I'm using my school's gitlab. The runner have only 4GB of memory and every time my pipeline fails on: Gradle build daemon disappeared unexpectedly. Is it normal that android project build needs more than 4GB of memory, or am I doing something wrong?
These plugins are in root build.gradle.kts:

Код: Выделить всё

plugins {
id("com.android.application") version "8.2.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
id("org.sonarqube") version "4.4.1.3373"
id("com.google.dagger.hilt.android") version "2.50" apply false
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
}
These plugins are in app/build.gradle.kts:

Код: Выделить всё

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
id("com.google.dagger.hilt.android")
id("com.google.devtools.ksp")
}
And these are the dependencies I use:

Код: Выделить всё

implementation("androidx.core:core-ktx:$androidCoreVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$androidxLifecycleVersion")
implementation("androidx.activity:activity-compose:$activityComposeVersion")
implementation(platform("androidx.compose:compose-bom:2023.10.01"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material:material")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
// navigation
implementation("androidx.navigation:navigation-compose:$navigationComposeVersion")
// Ktor http client
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
// Dagger hilt
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
implementation("androidx.hilt:hilt-navigation-compose:$hiltNavigationComposeVersion")
ksp("com.google.dagger:dagger-compiler:$daggerHiltVersion")
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")

// permission
implementation("com.google.accompanist:accompanist-permissions:$accompanistPermissionsVersion")
// arrow kt
implementation("io.arrow-kt:arrow-core:$arrowKtVersion")
implementation("io.arrow-kt:arrow-fx-coroutines:$arrowKtVersion")
// security
implementation("androidx.security:security-crypto:$androidSecurityCryptoVersion")

implementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion")

// bonsai - for tree view
implementation("cafe.adriel.bonsai:bonsai-core:$bonsaiVersion")
I have tried both KAPT and KSP without much difference.
I have even tired doing optimisations from: https://developer.android.com/build/optimize-your-build

Код: Выделить всё

org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError
org.gradle.parallel=true
org.gradle.configuration-cache=true
org.gradle.caching=true
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
android.enableJetifier=false
This is my .gitlab-ci.yml

Код: Выделить всё

image: eclipse-temurin:17-jdk-jammy

stages:
- build

variables:
ANDROID_COMPILE_SDK: "34"
ANDROID_BUILD_TOOLS: "34.0.0"
ANDROID_SDK_TOOLS: "11076708"

cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/
- app/build/

before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget unzip zip
- export ANDROID_HOME="${PWD}/android-sdk-root"
- install -d $ANDROID_HOME
- wget --no-verbose --output-document=$ANDROID_HOME/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
- unzip -q -d "$ANDROID_HOME/cmdline-tools"  "$ANDROID_HOME/cmdline-tools.zip"
- mv -T "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/tools"
- export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/tools/bin
- sdkmanager --version
- yes | sdkmanager --licenses > /dev/null || true
- sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
- sdkmanager "platform-tools"
- sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
- chmod +x ./gradlew

assembleDebug:
interruptible: true
stage: build
script:
- ./gradlew assembleDebug
- mv app/build/outputs/apk/debug/app-debug.apk housekeeper.apk
artifacts:
paths:
- app/build/outputs/
- housekeeper.apk
- build/
My project have roughly 20 screens. Am I doing something wrong or is it normal for build to need more than 4GB? And the runner just needs more memory. On normal gitlab where the runner have 8GB the pipepilne succeed


Источник: https://stackoverflow.com/questions/781 ... ine-memory
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»