Skip to content

Android Studio: Android gradle plugin and JDKs #154

Open
@nikitavlaev

Description

@nikitavlaev

Description

Android Gradle plugin builds tests before execution on Android Studio.
We use Java 8 to generate and run tests.
Android Gradle plugin requires Java 11.

To Reproduce

Steps to reproduce the behavior:

  1. Install Android Studio 2021.1.1
  2. Open the 'ASDemo' project in Android Studio, or any other project
  3. Set JDK8 as Gradle JDK
  4. Use plugin to generate tests for any class in library
  5. Open and run the generated test

Expected behavior

Test are supposed to be runnable correctly.

Actual behavior

Android plugin requires Java 11 to run tests.

Visual proofs (screenshots, logs, images)

image

Environment

Gradle JDK: 1.8

Additional context

There are possible workarounds:

  1. Change Gradle JDK to 11 before running tests.
  2. Create JUnit run configuration like below and turn on "Do not build before run"
    image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions