0

I have a well-functioning TFS build settings fro my projects which is works very well with my older android projects.

So recently I creted a new Android project, and I tried to build and create an apk with TFS, but I got an error when It started the unit test section, which says:

Failed to apply plugin 'com.android.internal.application'.

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options:

  • changing the IDE settings.
  • changing the JAVA_HOME environment variable.
  • changing org.gradle.java.home in gradle.properties.

In Android studio I checked, it is use the JDK 11, and in local I can build a release version from my project.

Unfortunatelly I don't have enough knowledge in TFS server builds, so I don't know what I have to do.

I can add more information, if it is helps, but please tell me what to attach

Andreas1234
  • 433
  • 4
  • 25
  • That's not error of your project but the environment that tries to build your project. It basically says there is Java 8 instead of 11 on the build server. – Agent_L Jan 10 '22 at 13:30
  • Thanks, so if I download, and install java 11 it could be solve the problem? – Andreas1234 Jan 10 '22 at 13:34
  • Your question was answered [here](https://stackoverflow.com/questions/66980512/error-message-android-gradle-plugin-requires-java-11-to-run-you-are-currently) – Mohammad Reza Khahani Jan 10 '22 at 13:57
  • I saw that, but in my tfs server there is an old android studi version, and I don't think It builds the projects. I think the projects are build by Visual Studio, but I may be wrong – Andreas1234 Jan 10 '22 at 14:15

2 Answers2

0

Set Gradle JDK to embedded(11.0.10) and same for environment variable.Go to Files>Settings> and search gradle and set jdk version.

Vidyesh Churi
  • 1,899
  • 1
  • 24
  • 33
0

Finally I solved this.

Although I installed the latest java sdk, and I refreshed the JAVE_HOME environment variable, but I didn't restart the server. When I restarted, the build was successfully

Andreas1234
  • 433
  • 4
  • 25