google-developer-training / android-basics-kotlin-mars-photos-app

Apache License 2.0
92 stars 193 forks source link

Android Basics: Get data from the Internet - step 3 "Execution failed for task ':app:kaptDebugKotlin' #115

Closed redeveloper3 closed 2 years ago

redeveloper3 commented 2 years ago

name: Android Basics Unit 4 issue about: Report problems with the Android Basics Unit 4 codelabs title: 'Android Basics Unit 4 issue:' labels: '' assignees: ''


URL of codelab

https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-getting-data-internet#2

In which task and step of the codelab can this issue be found?

Step 3 under 'Open the project in Android Studio' task 6 Run & build the app.

Describe the problem

When trying to build the downloaded code, in the Build Output I'm seeing:

Execution failed for task ':app:kaptDebugKotlin'.

Trying Analyse > Inspect Code displays OverviewFragment.kt:

'private val viewModel: OverviewViewModel by viewModels()'

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

Then I tried File -> Project Structure -> Suggestions

Viewing OverviewFragment.kt gives:

Kotlin library {0} was compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.

However - viewing Tools > Kotlin > Configure Kotlin Plugin Updates shows:

Current Kotlin plugin version 1.4.32-release-Studio4.1-1. You have the latest version of the plugin installed.

On clicking 'Details' in OverviewFragment.kt > Unsupported format plugin version 1.4.32 release Studio 4.1-1 kotlin-stdlib--1.6.10.jar (1.60) - expected: 1.42

Steps to reproduce?

  1. Run the app within Android Studio.
  2. See Build Output pane.
  3. See error "Execution failed for task ':app:kaptDebugKotlin'.

Versions Android Studio version: 4.1.1

API version of the emulator: 30

Additional information Kotlin 1.4.32 Gradle Plugin version 4.1.3 Gradle version 7.0.2 Current Kotlin plugin version 1.4.32-release-Studio4.1-1.

Any advice much appreciated - thanks.

redeveloper3 commented 2 years ago

Eventually I saw the message ""Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.3.1 or newer."

Upgrading Android Studio to Arctic Fox 2020.3.1 Patch 4 appears to have resolved the issue.