Thread
#multiplatform
    Rohan Maity

    Rohan Maity

    3 years ago
    According to docs to for android
    plugins {
        id("com.android.library")
        id("org.jetbrains.kotlin.multiplatform").version("1.3.31")
    }
    
    android { /* ... */ }
    
    kotlin {
        android { // Create the Android target
            // Provide additional configuration if necessary
        }
    }
    . But following this I get
    CONFIGURE FAILED in 0s
    Plugin [id: 'com.android.library'] was not found in any of the following sources:
    
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (plugin dependency must include a version number for this source)
    I am unable to apply android closure
    gildor

    gildor

    3 years ago
    If you set Android Gradle plugin without version it means that it must be in build classpath (for example applied by root project or in buildscript
    Rohan Maity

    Rohan Maity

    3 years ago
    buildscript {
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.3.2'
        }
    }
    
    plugins {
        id 'kotlin-multiplatform' version '1.3.31'
        id("com.android.library")
    }
    
    repositories {
        mavenCentral()
    }
    group 'io.thelimitbreaker'
    version '0.0.1'
    
    apply plugin: 'maven-publish'
    
    kotlin {
    
        jvm()
        js()
        // For ARM, should be changed to iosArm32 or iosArm64
        // For Linux, should be changed to e.g. linuxX64
        // For MacOS, should be changed to e.g. macosX64
        // For Windows, should be changed to e.g. mingwX64
        linuxX64("linux"){
           binaries{
               sharedLib{
                   baseName = "kparser"
               }
           }
        }
    
        sourceSets {
            commonMain {
                dependencies {
                    implementation kotlin('stdlib-common')
                }
            }
            commonTest {
                dependencies {
                    implementation kotlin('test-common')
                    implementation kotlin('test-annotations-common')
                }
            }
            jvmMain {
                dependencies {
                    implementation kotlin('stdlib-jdk8')
                }
            }
            jvmTest {
                dependencies {
                    implementation kotlin('test')
                    implementation kotlin('test-junit')
                }
            }
            jsMain {
                dependencies {
                    implementation kotlin('stdlib-js')
                }
            }
            jsTest {
                dependencies {
                    implementation kotlin('test-js')
                }
            }
            linuxMain {
            }
            linuxTest {
            }
        }
    }
    
    wrapper {
        gradleVersion = "5.1.1"
        distributionType = "ALL"
    }
    This is build.gradle file. I included buildScript closure . Still same error
    PS : this is only gradle file. Its root gradle file
    ilya.gorbunov

    ilya.gorbunov

    3 years ago
    The classpath specified in the
    buildscript
    block doesn't affect the
    plugins
    block in the same gradle file, because AFAIK
    plugins
    block is parsed and interpreted first of all.
    gildor

    gildor

    3 years ago
    And have buildscript and plugin block for the same plugin in the samee module doesn't make sense, if you want to use plugins block, just register Android plugin in settings.gradle using
    Rohan Maity

    Rohan Maity

    3 years ago
    How Can I register android plugin in setting.gradle ?
    gildor

    gildor

    3 years ago
    See this section in Gradle doca
    It's for Kotlin DSL, but it's exactly the same for Groovy
    Rohan Maity

    Rohan Maity

    3 years ago
    Same is written for kotlin-multiplatform plugin in settings.gradle
    I get it thanks
    gildor

    gildor

    3 years ago
    Yes, it works for any plugin which not published to Gradle Plugins portal
    Rohan Maity

    Rohan Maity

    3 years ago
    @gildor I have added android config block but now I am getting this error
    ERROR: Cannot read packageName from /home/thelimitbreaker/KParser/kparser/src/main/AndroidManifest.xml
    Affected Modules: KParser.kparser
    I have created the
    AndroidManifest.xml
    manually in specified path
    <manifest package="io.thelimitbreaker.kparser">
    
    </manifest>
    still getting this error
    gildor

    gildor

    3 years ago
    Yes, you have to create Android manifest and set package manually
    Check that your manifest XML is on correct dir
    Rohan Maity

    Rohan Maity

    3 years ago
    It was mentioned
    src/main/AndroidManifest.xml
    when I didn't create the file. So I created the file in that directory. Still got same error
    gildor

    gildor

    3 years ago
    idk, it's standard config, check paths again or share some sample if it doesn't work
    Rohan Maity

    Rohan Maity

    3 years ago
    I restarted my system . It worked 😅