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

Can't use android gradle plugin 7 with multiplatform template #584

Closed
ColtonIdle opened this issue Apr 12, 2021 · 5 comments
Closed

Can't use android gradle plugin 7 with multiplatform template #584

ColtonIdle opened this issue Apr 12, 2021 · 5 comments

Comments

@ColtonIdle
Copy link

I'm attempting to use com.android.tools.build:gradle:7.0.0-alpha01 - alpha12 and all of them fail with different error messages.

01 fails with

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.3 or newer.

12 fails with

An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.version-check'.
Minimum supported Gradle version is 6.8.2. Current version is 6.7.1. If using the gradle wrapper, try editing the distributionUrl in /Users/ernestg/Dev/MinimalComposeMultiplatform/gradle/wrapper/gradle-wrapper.properties to gradle-6.8.2-all.zip

So if I try to update gradle to 6.8.2, and THEN updating to alpha12, which you are greeted with this issue

Configuration with name 'testApi' not found.

Solved by: https://stackoverflow.com/questions/65372825/kotlin-multiplatform-configuration-issue

After applying the solution above you get hit with

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.3.1 or newer.

@ColtonIdle ColtonIdle changed the title Can't use android gradle plugin 7 Can't use android gradle plugin 7 with multiplatform template Apr 12, 2021
@malliaridis
Copy link

malliaridis commented Apr 12, 2021

tl;dr
I reproduced your issue. Upgrading your IDE to an unstable version (e.g. Android Studio to version Arctic Fox 2020.3.1 14) will probably fix your issue.

Steps to reproduce and fix the issue
Actual message
I tried to reproduce your issue by using

  • Gradle 7.0.0-alpha14
  • org.jetbrains.compose version 0.4.0-build180

and got too the "Configuration with name 'testApi' not found.".

After adding to the build.gradle.kts from the :common module the following lines:

android {
  // ...
      configurations {
        create("testApi")
        create("testDebugApi")
        create("testReleaseApi")
    }
}

I got the last error message. Then I just updated my Android Studio (might work as well for IntelliJ IDEA) to the canary (unstable) version Arctic Fox 2020.3.1 14 and the error disappeared.

It seems like the latest versions are only tested on the newest IDE versions for upcoming releases.

EDIT: I haven't however tested if compilation and whatsoever work properly. Any report for further steps would be great.

@ColtonIdle
Copy link
Author

Interesting. I didn't know that I should be using AS over intellij. Either way... maybe better error messaging would be helpful here.

@malliaridis
Copy link

malliaridis commented Apr 12, 2021

I didn't say that you should use Android Studio over IntellIJ IDEA, I just tested it on that IDE since it is based on IntellIJ IDEA and should work the same. The same however applies for IntelliJ IDEA. I just didn't want to upgrade IntelliJ IDEA to a probably unstable version just to test if it works.

But with that being said, I think I would personally prefer Android Studio if you develop cross-platform including android, because the IDE is pretty well optimized for android. But I don't know if compose-jb is supposed to work there too without further configurations.

Did the solution above solved your issue @ColtonIdle?

@malliaridis
Copy link

Btw. I just found this issue:
android/compose-samples#144

@olonho if the statement that is mentioned by nickbutcher applies for this project too, shouldn't we mention it also in the README.md?

@ColtonIdle
Copy link
Author

ColtonIdle commented Jun 1, 2021

As of 0.4.0 that I tried today, AGP 7 seems to work fine. Closing!

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

No branches or pull requests

2 participants