Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import compose sample projects to android studio version 4.2

I'm trying to import compose sample projects, but I'm facing this error:

Invalid injected android support version '202.7660.26.42.7322048', expected to be of the form 'w.x.y.z'

The android studio is currently updated to its newest version 4.2.

How can I fix this?

like image 776
TinaTT2 Avatar asked May 08 '21 11:05

TinaTT2


People also ask

Can I add jetpack compose to existing project?

If you want to use Jetpack Compose in an existing project, you'll need to configure your project with required settings and dependencies.

Is jetpack compose available in Android Studio?

For the best experience developing with Jetpack Compose, download and install Android Studio. It includes many smart editor features, such as new project templates and the ability to immediately preview your Compose UI and animations.


2 Answers

The version 202.7660.26.42.7322048 is

Android Studio 4.2
Build #AI-202.7660.26.42.7322048, built on April 29, 2021

As suggested in the current (1.0.0-beta08) official setup of compose you should use the Android Studio in the beta channel:

Android Studio Arctic Fox | 2020.3.1 Beta 03
like image 177
Gabriele Mariotti Avatar answered Oct 13 '22 16:10

Gabriele Mariotti


Two methods to resolve this issue:

  1. Update Android Studio to canary channel 2021.1.1 Canary 1(AI-203.7717.56.2111.7361063) which includes the fix
  2. If you wish to remain in Android Studio stable channel Build #AI-202.7660.26.42.7351085, built on May 10, 2021 then you will need to

Open Project Structure dialog (Ctrl+Alt+Shift+S) and select Android Gradle plugin version to 4.2.1 ( >4.2.1 has this bug till version 7.1.0-alpha01) and Gradle version to 7.0.2.

enter image description here

like image 36
LokiDroid Avatar answered Oct 13 '22 16:10

LokiDroid