gitlab-ci-android icon indicating copy to clipboard operation
gitlab-ci-android copied to clipboard

Now using JDK 17.

Open ravibpatel opened this issue 2 years ago • 6 comments

New Android Gradle Plugin (8.0.0) requires JDK 17.

https://developer.android.com/build/releases/gradle-plugin#groovy

ravibpatel avatar Apr 21 '23 08:04 ravibpatel

¡Necesito este cambio!

HarryAlvarado28 avatar May 16 '23 01:05 HarryAlvarado28

@jangrewe a very critical fix. After updating AGP to 8.0, the image stopped working with an error "Android Gradle plugin requires Java 17 to run. You are currently using Java 11. Your current JDK is located in /usr/lib/jvm/java-11-openjdk-amd64". When should we wait for the release with this fix?

akhbulatov avatar May 24 '23 13:05 akhbulatov

Folks, I forked the project, applied this change and uploaded it to docker hub. You can now use image: martinsumera/gitlab-ci-android. Seems like that it works fine for me.

I have added installation of both java 11 and java 17 to docker. Reason for this is that even though gradle requires java 17 for it's own internal purposes, Kotlin has some issues with java 17 compatibility. So I needed to install both versions and make project compatible with java 11.

android {
    ...
    compileOptions {
        isCoreLibraryDesugaringEnabled = true
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
        freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
    }
}

kotlin {
   jvmToolchain(11)
}

I also needed to setup JAVA_HOME directly in the CI in order to get it work

default:
  before_script:
    - export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64

Hope that it will help you.

Github project: https://github.com/SumeraMartin/gitlab-ci-android DockerHub project: https://hub.docker.com/repository/docker/martinsumera/gitlab-ci-android/general

SumeraMartin avatar May 25 '23 11:05 SumeraMartin

@SumeraMartin I am getting unable to access 'https://gitlab.com/xxxxxx/xxxxxx.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none. Can you add the following in the docker image?

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates -y 
sudo update-ca-certificates

ravibpatel avatar Dec 14 '23 06:12 ravibpatel

@ravibpatel feel free to create MR to that repo

SumeraMartin avatar Dec 14 '23 10:12 SumeraMartin

@SumeraMartin I think it won't be necessary. It seems image wasn't causing that issue after all.

ravibpatel avatar Dec 16 '23 12:12 ravibpatel