Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now using JDK 17. #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Now using JDK 17. #77

wants to merge 1 commit into from

Conversation

ravibpatel
Copy link

New Android Gradle Plugin (8.0.0) requires JDK 17.

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

New Android Gradle Plugin (8.0.0) requires JDK 17.
@HarryAlvarado28
Copy link

¡Necesito este cambio!

@akhbulatov
Copy link

akhbulatov commented May 24, 2023

@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?

@SumeraMartin
Copy link

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

@ravibpatel
Copy link
Author

ravibpatel commented Dec 14, 2023

@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

@SumeraMartin
Copy link

@ravibpatel feel free to create MR to that repo

@ravibpatel
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants