NoClassDefFoundError: error when generating apk - compilation

migrate my application to android x and gradle 5
the moment that I send to generate the apk or to install gives me this error
Caused by: java.lang.NoClassDefFoundError: com/android/tools/r8/dex/ApplicationReader
Build.graddle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "gortiz.com.goapp"
minSdkVersion 18
targetSdkVersion 28
versionCode 37
versionName '2.0.37'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
implementation 'androidx.appcompat:appcompat:1.+'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.+'
implementation 'androidx.mediarouter:mediarouter:1.+'
implementation 'androidx.core:core:1.+'
implementation 'androidx.multidex:multidex:2.+'
implementation 'com.google.android.material:material:1.+'
implementation 'commons-io:commons-io:2.5'
implementation 'androidx.constraintlayout:constraintlayout:1.+'
implementation 'androidx.legacy:legacy-support-v4:1.+'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.github.satyan:sugar:1.5'
implementation 'com.squareup.picasso:picasso:2.5.0'
implementation 'me.panavtec:wizard:1.2'
implementation 'com.github.johnkil.print:print:1.2.+'
implementation 'com.github.bmelnychuk:atv:1.2.+'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
testImplementation 'junit:junit:4.12'
implementation 'androidx.recyclerview:recyclerview:1.+'
implementation ('com.google.firebase:firebase-messaging:17.3.4'){
exclude group: 'com.google.firebase', module: 'firebase-iid'
}
implementation 'com.google.android.gms:play-services-maps:17.+'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.android.gms:play-services-vision:18.+'
implementation 'com.google.firebase:firebase-config:18.+'
implementation 'com.google.firebase:firebase-iid:17.0.2'
implementation 'androidx.annotation:annotation:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
graddle.properties
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
Caused by: java.lang.NoClassDefFoundError: com/android/tools/r8/dex/ApplicationReader

The top level build.gradle seems to be missing a dependency on Android Gradle Plugin. Please add something like this (depending on the version you would like to use):
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
...
}
...
}
If you create an empty project in Android Studio that should all be in place.

Related

unresolved reference: github (cant import to my class)

I tried to download a library. But I think i did something wrong in my build.gradle Project. Because when I try to import the library manually, I get this error:
My Project Gradle File
buildscript {
repositories {
google()
maven {url 'https://jitpack.io'}
}
dependencies {
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3")
}
}
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App Gradle File
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.ahmetkaan.kediy"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
//...
implementation 'com.github.onecode369:WYSIWYG:4.0'
}
The library says me to add " maven {url 'https://jitpack.io'} " this to my project gradle and " implementation 'com.github.onecode369:WYSIWYG:4.0' " this to my app gradle. I think there is a problem in the project gradle's repositories (maven). Because the library says to me add like this;
allprojects {
repositories {
...
maven {url 'https://jitpack.io' }
}
}
But I can't add allprojects on top of repositories. I am getting an error like:
A problem occurred evaluating root project 'Kediy'.
> Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'
What should I do?

Build failed - Could not find androidx.lifecycle:compiler:2.2.0

I am totally new to Android and struggling past 2days with my build.
I get the following message
Build failed
Could not find androidx.lifecycle:compiler:2.2.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/lifecycle/compiler/2.2.0/compiler-2.2.0.pom
- https://jcenter.bintray.com/androidx/lifecycle/compiler/2.2.0/compiler-2.2.0.pom
Required by: project :app
I updated my studio and gradle plugins and versions of dependencies, but none seem to work. I am using Gradle Plugin: 4.0.1 and Gradle: 6.1.1
My project gradle is as follows
buildscript {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xxxx.xxxxxx"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
def room_version = "2.2.0"
def lifecycle_version = "2.2.0"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// Annotation processor
annotationProcessor "androidx.lifecycle:compiler:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
}
In the idea.log i find the line
testKnownPluginVersionProvider - 'gradle' plugin missing from the offline Maven repo, will use default 4.0.1
repeating regularly and the gradle-wrapper properties file is as follows
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Remove the following line if you are using Java 8:
annotationProcessor "androidx.lifecycle:compiler:$lifecycle_version"

Got empty license reports with hierynomus' gradle license plugin

I'm making two android apps on a Gradle project and managing dependency licenses with Hierynomus' gradle license plugin.
Then, I executed following commands:
$ ./gradlew downloadLicenses
$ cat ./build/reports/license/dependency-license.json
But the generated license reports are empty.
{"dependencies":[]}
I tried to fix the problem with the documents below:
https://github.com/hierynomus/license-gradle-plugin/issues/81
https://github.com/hierynomus/license-gradle-plugin/issues/103
https://github.com/hierynomus/license-gradle-plugin/issues/137
https://github.com/hierynomus/license-gradle-plugin/issues/174
but I couldn't resolve the problem.
Next, I tried to execute the task with --refresh-dependencies and --rerun-tasks options. Sadly, the problem hadn't fixed.
Those are my build scripts:
// build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_coroutine_version = '1.1.1'
repositories {
google()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.12.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
}
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.hierynomus.license'
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'implementation'
ext.apacheTwo = license('Apache License, Version 2.0', 'https://opensource.org/licenses/Apache-2.0')
ext.bsd = license('BSD License', 'https://opensource.org/licenses/bsd-license')
aliases = [
(apacheTwo): [
'The Apache Software License, Version 2.0',
'Apache 2',
'Apache License Version 2.0',
'Apache License, Version 2.0',
'Apache License 2.0',
license('Apache License', 'https://www.apache.org/licenses/LICENSE-2.0')
],
(bsd): [
'BSD',
license('New BSD License', 'https://opensource.org/licenses/bsd-license')
]
]
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.console"
minSdkVersion 26
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'
}
}
lintOptions {
lintConfig file("lint.xml")
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:26.1.0'
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'
}
apply plugin: 'com.google.gms.google-services'
// client/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.client"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps:google-maps-services:0.9.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'org.jetbrains.spek:spek-api:1.1.5'
testImplementation 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testImplementation 'org.mockito:mockito-core:+'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.platform:junit-platform-runner:1.1.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
No doubt I expected dependencies license reports of my project were generated under ${PROJECT_ROOT}/build/reports/license/. I found the reports are generated, however, those were empty.
Thanks!
It seems to be a problem with version 0.15.0 Fix getting licenses on Android.
For me, it worked with version 0.14.0 and some additional configurations:
// buil.gradle root
plugins {
id "com.github.hierynomus.license" version "0.14.0"
}
downloadLicenses {
dependencyConfiguration = 'implementation'
includeProjectDependencies = true
}
// build.gradle app
apply plugin: 'com.github.hierynomus.license'
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)

Unable to resolve dependency for ':app#debugUnitTest/compileClasspath', :app#debugAndroidTest/compileClasspath

Situation:
Create the simplest project
Add to the project module as File -> New -> New module "Phone & Tablet Module"
Add the dependency on the module
And get errors:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve project :testmodule.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve project :testmodule.
Below are the project files:
Project:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// 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
}
Module: app
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.pawga.test00"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
implementation project(path: ':testmodule')
}
Module: testmodule
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.pawga.testmodule"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
gradle-wrapper.properties
#Mon Jun 25 22:51:52 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
settings.gradle
include ':app', ':testmodule'
Note:
If the module type is "Android Library" (Point "two" above), then there are no such errors.
For such a simple project, where everything is by default, there should not be such errors. What's wrong?
Try this, replace:
implementation project(':testmodule')
To:
implementation project(path:':testmodule', configuration: 'default')
Go to
File -> Settings -> Build, Execution, Deployment -> Gradle menu.
You will see "Offline work" options. Uncheck it. And it's ok.
It looks like your plugin needs to be changed to apply plugin: 'com.android.library' instead of 'com.android.application'
See this post for more
information. Hope that helps.
Try online mode for gradle. Hope it helps(I had the same problem, so more chances).
##REMOVE THE FOLLOWING FROM THE BUILD GRADLE##
>>implementation 'com.android.support:appcompat-v7:28.+'
>>implementation 'com.android.support.constraint:constraint-layout:1.0.2'
>>androidTestImplementation 'com.android.support.test:runner:1.0.1'
>>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
>>SEE ATTACHED PICTURE
>>[STUDIO ERRORS][1]
>>[1]: https://i.stack.imgur.com/DY6sz.png

error: cannot find symbol class for add kotlin class into java class in android studio 3.0 stable

i use android studio 3.0 and some old java class Convert Java to Kotlin. after that Kotlin class cant import in java class!
in below you can see my gradle and a picture of my error.
module build.grade
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
in app level build.gradle in normally i use gradle code and in android 3.0 i think we need any thing
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.idehnavazan.beautifierclient"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.rey5137:material:1.2.2'
compile 'com.android.support:cardview-v7:25.3.1'
}
apply plugin: 'com.google.gms.google-services'
To work with Kotlin files you need to add Kotlin to your project.
project/build.gradle
buildscript {
ext.kotlinVersion = '1.1.51'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
project/module/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
What's next
Since you're using support library 25.3.1 and Android plugin 3.0.0 your next question will probably be this: style attribute '#android:attr/windowEnterAnimation' not found.
I have added all kotlin classes in separate folder and it work for me!
Keep your java classes separate from kotlin. I was having
app:compileDebugJavaWithJavac Kotlin class calling from java: error: cannot find symbol
compile time error.
My issue was that I have imported a submodule using
testImplementation instead of implementation inside of module gradle file that is declaring your module as a dependency.
Changing the dependency declaration fixed it for me.
I am also new to kotlin/android and was using ViewBinding. I was renaming an xml-file when this type of error occured. I just added:
dataBinding {
enabled = true
}
to the build.gradle(module)-file and it now works. To be honest, I never understood the difference between view- and data-binding
kotlin/android and was using ViewBinding.
just add this inside build.gradle(module)-file
viewBinding{
enabled = true
}

Resources