https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sergio Casero

10/10/2018, 4:46 PM
Hello guys! Maybe this is a noob question, but I'm getting a frustrating error. I'm starting to test the multiplatform but I'm getting this error when I try to build android with intelliJ
Plugin with id 'com.android.application' not found.
But if try with gradlew assembleDebug, it works, and also works the "run" task without any problems and the apk is correctly installed. Any idea? (I can share the build.gradle files if you need them 🙂 )
d

Dominaezzz

10/10/2018, 5:02 PM
Share!
s

Sergio Casero

10/10/2018, 5:04 PM
Ok!
global build.gradle
Copy code
allprojects {
    buildscript {
        repositories {
            maven { url "<http://kotlin.bintray.com/kotlin-eap>" }
            maven { url "<http://kotlin.bintray.com/kotlin-dev>" }
            maven { url "<https://kotlin.bintray.com/kotlinx>" }
            maven { url '<https://dl.bintray.com/jetbrains/kotlin-native-dependencies>' }
            maven { url "<https://plugins.gradle.org/m2/>" }
            jcenter()
            mavenCentral()
            mavenLocal()
            google()
        }
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.9.2-dev-3973"
            classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.32"
            classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
        }

    }
    repositories {
        maven { url "<http://kotlin.bintray.com/kotlin-eap>" }
        maven { url "<http://kotlin.bintray.com/kotlin-dev>" }
        maven { url "<https://kotlin.bintray.com/kotlinx>" }
        maven { url "<http://dl.bintray.com/kotlin/kotlin-js-wrappers>" }
        maven { url "<https://dl.bintray.com/sargunster/maven>" }
        mavenLocal()

        google()
        jcenter()
    }
}
common:
Copy code
apply plugin: 'kotlin-platform-common'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-common"
    testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common"
    testCompile "org.jetbrains.kotlin:kotlin-test-common"
}
jvm:
Copy code
apply plugin: 'kotlin-platform-jvm'

repositories {
    mavenCentral()
}

dependencies {
    expectedBy project(":votlin-common")

    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

    testCompile "junit:junit:4.12"
    testCompile "org.jetbrains.kotlin:kotlin-test"
    testCompile "org.jetbrains.kotlin:kotlin-test-junit"
}
Root Android:
Copy code
buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
And app module:
Copy code
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.votlin.android"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
        }
    }
}

dependencies {
    implementation project(":votlin-jvm")
    
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
The project is based on Marcin Moskala project
l

Liliia

10/11/2018, 6:40 AM
Try to reorder repositories at global `build.gradle`:
google()
first, then
jcenter()
s

Sergio Casero

10/11/2018, 8:54 AM
I've just changed the structure
Right now I'm following the kotlinconf app with adding the js module, is available here -> https://github.com/sergiocasero/votlin-app
I can deploy Android and React js well 🙂
2 Views