Cannot build project - android

I trying to assemble my project, but I only get an error:
Error:Execution failed for task ':basetools:processDebugAndroidTestResources'.
> No slave process to process jobs, aborting
I didn't change anything in my gradle files but abruptly got this error.
I already tried invalidate cahces and restart, rebuild
What should I do to fix it?
This is my project's build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
apply from: 'scripts/dependencies.gradle'
apply from: 'scripts/testDependencies.gradle'
repositories {
google()
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url "https://maven.google.com"
}
maven { url 'https://jitpack.io' }
}
dependencies {
classpath plugin.android
classpath plugin.fabric
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url "https://maven.google.com"
}
maven { url 'https://jitpack.io' }
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "1000" // or whatever number you want
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is a build.project of app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
def mainKeystore = file("../main.keystore")
//def debugKeystore = file("../debug.keystore")
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.ilyinp.valutetracker"
minSdkVersion 19
targetSdkVersion 26
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
release {
storeFile mainKeystore
keyAlias "valutetracker"
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental = false
}
}
kapt {
generateStubs = true
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile project(base.baseTools)
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
kapt "com.android.databinding:compiler:3.0.0"
compile dep.dagger.lib
kapt dep.dagger.apt
compile dep.moxy.lib
compile dep.moxy.appCompat
kapt dep.moxy.apt
compile(dep.crashlytics) {
transitive = true
}
compile 'com.google.android.gms:play-services-ads:11.6.0'
}
apply plugin: 'com.google.gms.google-services'
And finally, build.gradle of module basetools
apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
kapt {
generateStubs = true
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile dep.support.multiDex
// compile dep.support.appCompat
compile dep.support.cardView
compile dep.support.recyclerView
compile dep.support.design
compile dep.support.constraintLayout
compile dep.glide.lib
compile dep.glide.transformations
compile dep.rxjava.lib
compile dep.rxjava.android
compile dep.rxjava.permissions
compile dep.rxjava.binding
compile dep.rxjava.bindingCompat
compile dep.retrofit.lib
compile dep.retrofit.converter.gson
compile dep.retrofit.adapter.rxjava
compile dep.okhttp.lib
compile dep.okhttp.interceptor.logging
compile dep.dagger.lib
kapt dep.dagger.apt
compile dep.timber
compile dep.moxy.lib
compile dep.moxy.appCompat
kapt dep.moxy.apt
compile dep.materialDialogs
compile dep.parceler.lib
kapt dep.parceler.apt
compile dep.cicerone
compile(dep.fastadapter) {
transitive = true
}
compile(dep.fastadapterCommons)
compile(dep.fastadapterExtensions)
compile(dep.materialize) {
transitive = true
}
compile(dep.crashlytics) {
transitive = true
}
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
kapt "com.android.databinding:compiler:3.0.0"
}
repositories {
mavenCentral()
}

Go to Android Studio, click "File" and click "Invalidate Caches / Restart...". This will work.

change
minifyEnabled true
to
minifyEnabled false
if above changes does not work then try this as well
shrinkResources true
to
shrinkResources false

Restarting Android Studio wasn't enough to resolve this error for me: I also had to kill an aapt2 process which had been left behind.

Same issue. Invalidate caches and restart done the job for me.

You can delete build folder in project and modules. After Invalidate Caches and Restart , it work for me!
You can try it

'Clean Project'、'rebuild project' doesn't work.I solved this problem by invalidate and restart

Delete build folder manually (project's build and modules' build)
Delete old .impl file
Restart Android Studio

I was going through some RnD and applied above nothing worked, rather that made my project to crash completely and re do.
I was not shutting down and restart the system everyday.
When I got the next time I simply didn't do anything but restarted the system. It worked fine!!..
Guys , keep in mind : Invalidate Caches and Restart will make you loose complete history of code changes.
shrinkResources to false /
minifyEnabled to false will cost you few kbs of apk size

Related

Dex Error while building the project

I am getting the following error when I try to build my project. This error occurs when I was trying to add JavaMail api in my project.
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.persi.eatery"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/mailcap.default'
exclude 'META-INF/mimetypes.default'
}
defaultConfig {
multiDexEnabled true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.sun.mail:android-mail:1.6.1'
implementation 'com.sun.mail:android-activation:1.6.1'
implementation project(':library')
}
apply plugin: 'com.google.gms.google-services'
My library gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.java.net/content/groups/public/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
P.S I have already tried Clean project followed by rebuild project as suggested in other answers but its still not working.Thanks in advance
Unable to merge dex
You have a dependencies conflict. Try to see your dependencies via command ./gradlew app:dependencies (Details here ). And you will see the next situation:
As you can see android-mail depends on android-activation. I think you don't need to use the line implementation 'com.sun.mail:android-activation:1.6.1'
P.S. For debugging builds you can use the next flag "--stacktrace". Then you can see more information about your issue.

Resolved versions for app (1.1) and test app (1.3) differ

I'm beginner with android and gradle. I saw this error so I removed the hamcrest dependency from my module gradle but I still see the following error:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'org.hamcrest:hamcrest-core' in project ':app'. Resolved versions for app (1.1) and test app (1.3)
differ.
This dependency is causing the problem:
compile 'com.android.support.test:testing-support-lib:0.1'
app grade:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
module gradle (I have a single module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.stavalfi.app1"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
compile 'com.android.support:support-annotations:22.2.0'
androidTestCompile 'com.android.support.test:runner:1.0.0'
androidTestCompile 'com.android.support.test:rules:1.0.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
compile 'com.android.support.test:testing-support-lib:0.1'
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.0.0'
}//testImplementation
apply plugin: 'com.google.gms.google-services'
What I have tried:
//testCompile 'junit:junit:4.12'
testCompile('junit:junit:4.12') { // Prevent duplication conflicts
exclude module: 'hamcrest-core'
exclude module: 'hamcrest-library'
exclude module: 'hamcrest-integration'
}
But I get the same error.
I also saw this solution but I don't know where to add the configurations exactly:
Robolectric 3.0-rc2 Hamcrest-core conflict
And I don't see why I need to have this problem if I don't use hamcrest anyway.
Thanks!
add configuration.all below buildtypes.
configurations.all {}
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.nfs.ui.notesapp"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:24.0.0'
}
}

Cannot invoke method version() on null object

i'm trying to use the Jgrapht library but it needs lambdas...
Here's my code:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the :app
apply plugin: "me.tatarka.retrolambda" version "3.3.0"
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "it.univpm.gruppoids.iotforemergencyandnavigation"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.1'
compile 'org.jgrapht:jgrapht-core:1.0.0'
}
The error is: Error:(1, 0) Cannot invoke method version() on null object
Open File
Where and what is the error? thanks
You're mixing two kinds of syntaxes. Use either
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
}
}
apply plugin: 'me.tatarka.retrolambda'
or
plugins {
id "me.tatarka.retrolambda" version "3.3.0"
}
(gradle-retrolambda README), see also the gradle documentation.
I have the same issue.
You'll need to update a few things:
android/build.gradle:
i) classpath 'com.google.gms:google-services:4.0.1'
ii) Make sure google() appears above jcenter() in both buildscripts and allprojects
android/app/build.gradle:
Update Android libs to the latest specified here:
https://firebase.google.com/support/release-notes/android#20180523
if you have other libraries (for me, it's firebase) make sure to check build.gradle of the libraries, too.

Gradle plugins (findbugs, pmd, jdepend, checkstyle) not working

I have the follow app bulild.gradle for my project. When I run the command gradle check no output is reported in the app/build/ folder. I basically used the same code for a previous project and it seemed to work just fine.
apply plugin: 'com.android.application'
apply plugin: "findbugs"
apply plugin: 'pmd'
apply plugin: "jdepend"
apply plugin: 'checkstyle'
findbugs {
ignoreFailures = false
effort = "max"
reportLevel = "low"
}
pmd {
ignoreFailures = true
}
jdepend{
ignoreFailures = true
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl')
}
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "dat255.refugeeevent"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.code.gson:gson:2.7'
testCompile 'junit:junit:4.12'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile files ('libs/microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar')
}
Check out gradle fury's quality plugin, works on android and non android projects https://github.com/gradle-fury/gradle-fury. We use it has something to force reports for the site plugin. It's largely based off of work of others with lots of tweaks to make it work correctly for both android and non android projects.
apply it
allprojects {
apply from: "https://raw.githubusercontent.com/gradle-fury/gradle-fury/master/gradle/quality.gradle"
}
and then you'll need the contents from here: https://github.com/gradle-fury/gradle-fury/tree/master/config cloned into your repo. Just the config folder, the rest of the stuff isn't needed.
finally, either call any gradle tasks that requires check. So any one of the following should do the trick
gradlew build
gradlew check
gradlew install (if you're running the maven-support stuff from fury)
Add below configuration to you gradle.build file. Basically it does not find android repository and related details in your configuration.
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}

Android Studio build failed with Kotlin

:app:mergeDebugAssets
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK kotlin/internal/internal.kotlin_builtins
File1: /Users/KD/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.0.4/172b43fbc03b521fed141484b212d6725fa671a9/kotlin-compiler-embeddable-1.0.4.jar
File2: /Users/KD/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/1.0.4/8e25da5e31669f5acf514bdd99b94ff5c7003b3b/kotlin-runtime-1.0.4.jar
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.app2par.ctime"
minSdkVersion 16
// minSdkVersion 21
// targetSdkVersion 23
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled false
// multiDexEnabled true
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "2g" // Use gig increments depending on needs
incremental true
}
buildTypes {
debug {
minifyEnabled false
// testCoverageEnabled true
// ext.betaDistributionReleaseNotes = getCrashlyticsBetaMessage()
// ext.betaDistributionGroupAliases = 'team'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
// dataBinding {
// enabled = true
// https://code.google.com/p/android/issues/detail?id=187443&q=attachments%3D0&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
// }
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':firebasesync')
compile project(':liboid')
compile project(':cloudtimemodel')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') {
exclude group: 'com.android.support'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
exclude group: 'com.android.support'
}
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
// transitive = true;
// }
// compile 'com.google.android.gms:play-services:5.0.89'
// compile 'com.google.android.gms:play-services:7.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// compile 'com.firebase:firebase-client-android:2.0.3.+'
// compile 'com.google.android.gms:play-services-safetynet:8.3.0'
// compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.android.gms:play-services-plus:7.0.0' // play-services-plus:7.0.0 : office-mover
// compile 'com.google.android.gms:play-services-auth:8.3.0' // play-services-auth:8.3.0 : ShoppingList++
// compile 'com.google.android.gms:play-services-identity:7.0.0'
}
buildscript {
// ext.kotlin_version = '1.0.0-rc-1036'
ext.kotlin_version = '1.0.4'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'org.ajoberstar:grgit:1.1.0'
// classpath 'io.fabric.tools:gradle:1.+'
// classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.5.0-x'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
How to fix or diagnose this?
You should remove compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" from your dependencies section and move it to buildscript { dependencies { ... } }.
You did put compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" in the wrong build.gradle file
You may use kotlin plugin's build-in converters to deal with this. According to Kotlin Docs:
Configuring Kotlin in the project
When adding a new Kotlin file, IntelliJ IDEA (and Android Studio)
automatically prompts us as to whether we'd like to configure the
Kotlin runtime for the project. However, currently, converting
existing Java file does not prompt this action. Therefore we have to
invoke it manually (via Find Action):
We are then prompted for the version of Kotlin. Choose the latest
available from the list of installed versions.
After we configure Kotlin, build.gradle file for the application
should be updated. Now we can see that apply plugin: 'kotlin-android'
and the dependencies were added.
(For more details how to set up gradle for your project, please check
Using Gradle)
The last thing to do is to sync the project. We can press Sync Now
in a prompt or invoke an action Sync Project with Gradle Files.
From: https://kotlinlang.org/docs/tutorials/kotlin-android.html
Check link above for more information.
Hope it will help.
you need to apply only one plugin, in your case apply plugin: 'kotlin-android-extensions' and only compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" this dependency. it worked for me

Categories

Resources