Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to add Kotlin Android Extensions to my project

When i try to add kotlin-android-extensions via:

apply plugin: 'kotlin-android-extensions'

to my project Android Studio tells me Plugin with 'kotlin-android-extensions not found??

What is going wrong? I am Running Android Studio 3.0 Canary 8

like image 386
Rik van Velzen Avatar asked Jul 30 '17 14:07

Rik van Velzen


People also ask

Why is Kotlin extensions deprecated?

They are not supported with Java. There are still projects that are written in Java and may not be fully migrated to Kotlin yet, and hence Kotlin Synthetics may not be a consistent way of getting the ViewIds in your project. Because of these issues, Kotlin Synthetics is now being deprecated.


4 Answers

I think it's all about ordering, make sure you have plugin orders like that

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'realm-android' 
like image 175
Jemo Mgebrishvili Avatar answered Sep 25 '22 13:09

Jemo Mgebrishvili


Android Studio 4.1

plugins {     id 'com.android.application'     id 'kotlin-android'     id 'kotlin-android-extensions' } 
like image 25
Gabor Szigeti Avatar answered Sep 24 '22 13:09

Gabor Szigeti


I think it's all about ordering, make sure you have plugin orders like that

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
like image 36
jemo mgebrishvili Avatar answered Sep 24 '22 13:09

jemo mgebrishvili


Please also consider that you must be careful about apply plugin: orders:

So in order to apply kotlin-android-extensions you must first apply kotlin-android. Same as the following coode:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
like image 35
Ramin Ar Avatar answered Sep 25 '22 13:09

Ramin Ar