question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying Plugin template results in error in the :common folder: > The 'java' plugin has been applied, but it is not compatible with the Android plugins.

See original GitHub issue

I want to try the feature out to develop both Android and Desktop application.

I just intalled v1.0.0 of the Plugin: Compose Multiplatform IDE Support on my IntelliJ 2021.3 Ultimate (Build #IU-213.5744.223, built on November 27, 2021). Windows is running at version: Windows 10 Pro Version 21H2 OS build 19044.1387

Which template I chose: File > New > Project: chose Kotlin > chose Compose Multiplatform Application uses Kotlin 1.5.21 > Next > Finish

Error I get:

A problem occurred configuring project ‘:common’.

The ‘java’ plugin has been applied, but it is not compatible with the Android plugins.

It generated the following build. It wont’t build because there’s an error in the common build.gradle.kts. (All the other scripts could be build when removed the lines where it would include :common)

import org.jetbrains.compose.compose

plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose") version "1.0.0-alpha3"
    application
    id("com.android.library")
}

group = "com.project"
version = "1.0"

kotlin {
    android()
    jvm("desktop") {
        compilations.all {
            kotlinOptions.jvmTarget = "11"
        }
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting {
            dependencies {
                api("androidx.appcompat:appcompat:1.2.0")
                api("androidx.core:core-ktx:1.3.1")
            }
        }
        val androidTest by getting {
            dependencies {
                implementation("junit:junit:4.13")
            }
        }
        val desktopMain by getting {
            dependencies {
                api(compose.preview)
            }
        }
        val desktopTest by getting
    }
}

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(24)
        targetSdkVersion(30)
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

application {
    mainClass.set("MainKt")
}

Any solutiuons or workaround is creatly appreciated!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
akurasovcommented, Jan 11, 2022

The fix has been developed. It should be available with the new kotlin plugin for idea 21.3 (there is no such issue in older versions)

0reactions
jimgoogcommented, Jul 15, 2022

@igordmn Do you know the status of this bug / based on the last comment it is unclear if it should be closed or if it remains open for reasons?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java plugin has been applied, not compatible with android
The problem is that you cannot apply both the com.android.application and the java plugin in the same module. Why are you doing that?...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This page tracks known issues with Android Studio Dolphin | 2021.3.1 and Android Gradle plugin 7.3.1. If you experience an issue not already...
Read more >
Improve your code with lint checks - Android Developers
The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, ...
Read more >
Meet Android Studio | Android Developers
On top of IntelliJ's powerful code editor and developer tools, ... Code templates and GitHub integration to help you build common app features...
Read more >
Android Studio Dolphin | 2021.3.1
The following table lists which version of the Android Gradle plugin is required for each version of Android Studio. If your project is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found