add kapt androidx room in gradle makes data binding error - android

After I add kapt "androidx.room:room-compiler:2.1.0-alpha05"
I get error when doing data binding. Here is my app gradle :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "insure.onoff"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Gradle automatically adds 'android.test.runner' as a dependency.
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
applicationVariants.all {
variant ->
variant.outputs.all {
outputFileName = "./" + outputFileName
}
}
}
dependencies {
kapt "androidx.room:room-compiler:2.1.0-alpha05"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.room:room-runtime:2.1.0-alpha05'
implementation 'android.arch.work:work-runtime-ktx:1.0.1-rc01'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// AWS Dependencies
implementation "com.amazonaws:aws-android-sdk-core:2.11.1"
implementation "com.amazonaws:aws-android-sdk-auth-core:2.11.1"
implementation("com.amazonaws:aws-android-sdk-auth-userpools:2.11.1") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-auth-ui:2.11.1") { transitive = true }
implementation 'com.facebook.android:facebook-login:4.36.0'
implementation "com.google.android.gms:play-services-auth:16.0.1"
// Testing dependencies
androidTestImplementation "androidx.arch.core:core-testing:2.0.0"
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.1.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.1.1"
androidTestImplementation "androidx.test.espresso:espresso-intents:3.1.1"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
testImplementation "junit:junit:4.12"
}
project gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
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
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error :
My Android Studio version :
Android Studio 3.3
Build #AI-182.5107.16.33.5199772, built on December 25, 2018
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.12.5

When you get databinding errors, they are usually the result of a compilation error within the code.
Using the picture you have posted as reference, there are 4 Icons on the vertical toolbar on the left side of the screen. The top icon is the green hammer. Click the icon just below that (the 2nd one, it looks like two screens layered on top of each other). Clicking this icon opens up a different view that describes in detail what the compiler did not like - you generally will find what is causing the problems.
You can also run "gradle build -debug" or some other debug tracing cmd for gradle that will print in detail what the errors are.
Double check kotlin is compiling to your target jvm version 1.8
If all else fails, try clean/build + invalidate/cache + restart. Hope this helps.

Related

InvalidPluginRequestException Gradle AndroidStudio

I have imported existing android project after 2 months, and when it started to sync the gradle, it gave some strange error, because earlier the project was working properly.
The error is Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath.
below is my gradle file :
build.gradle (:app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.quickshop"
minSdkVersion 21
targetSdkVersion 30
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
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.hbb20:ccp:2.5.0'
implementation 'com.steelkiwi:badge-holder-view:1.1.0'
implementation 'com.mikhaellopez:circularimageview:4.2.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
implementation 'me.himanshusoni.quantityview:quantity-view:1.2.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
implementation 'com.github.MindorksOpenSource:EditDrawableText:2.0'
implementation 'com.razorpay:checkout:1.6.6'
implementation 'in.shadowfax:proswipebutton:1.2.2'
implementation 'com.google.firebase:firebase-auth:20.0.4'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-messaging'
implementation platform('com.google.firebase:firebase-bom:26.8.0')
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.6.0'
implementation 'com.google.firebase:firebase-storage:19.2.1'
implementation 'cc.cloudist.acplibrary:library:1.2.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle
include ':app'
rootProject.name = "QuickShop"
I tried to find solution for this, but didnt find a proper solution that can resolve this issue, can anyone please help me with this and this new gradle plugin invocation.
android version : Android Studio Arctic Fox | 2020.3.1 Patch 3,
gradle version : 4.1,
Android gradle plugin version : 3.0.1

Updated to Android Studio Arctic Fox and now I get "Kotlin not configured"

I just upgraded Android Studio to the latest stable version (Arctic Fox 2020.3.1) on Mac, and now my project doesn't build. I get a "Kotlin not configured" in the IDE top bar, and in the build output I get this error:
Could not find org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.5.21.
Required by:
project :app
I tried to add this dependency to the app module Gradle file, but the error remains:
implementation "org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version"
For your reference, here is my Project Gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = "1.5.21"
version_navigation = "2.3.5"
version_lifecycle_extensions = "2.2.0"
version_lifecycle = "2.3.1"
version_room = "2.4.0-alpha04"
//version_room = "2.2.6"
version_coroutine = "1.5.0"
version_retrofit = "2.9.0"
version_moshi = "1.9.3"
version_retrofit_coroutines_adapter = "0.9.2"
version_glide = "4.12.0"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath 'com.android.support:multidex:1.0.3'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
// 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
}
And here is my Module Gradle file:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id "org.jetbrains.kotlin.kapt"
id 'androidx.navigation.safeargs'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.virtualsheetmusic.vsheetmusic"
minSdkVersion 21
targetSdkVersion 30
versionCode 20
versionName "2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
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 {
//dataBinding includes viewBidning below https://stackoverflow.com/questions/58040778/android-difference-between-databinding-and-viewbinding
dataBinding true
// for view binding only:
// viewBinding true
}
}
dependencies {
//implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//implementation "org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.fragment:fragment-ktx:1.3.6"
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
//Lifecycle and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$version_lifecycle_extensions"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$version_lifecycle"
//Room
implementation "androidx.room:room-runtime:$version_room"
kapt "androidx.room:room-compiler:$version_room"
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$version_room"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_coroutine"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_coroutine"
// Testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//For Internet connectiona and JSON stuff...
// Moshi
implementation "com.squareup.moshi:moshi:$version_moshi"
implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
//implementation "com.squareup.retrofit2:converter-scalars:$version_retrofit"
// Retrofit with Moshi Converter
implementation "com.squareup.retrofit2:converter-moshi:$version_retrofit"
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$version_retrofit_coroutines_adapter"
//Glide
implementation "com.github.bumptech.glide:glide:$version_glide"
annotationProcessor "com.github.bumptech.glide:compiler:$version_glide"
//Recyclerview swipe-refresh...
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
//For PDF and download management from here: https://blog.mindorks.com/how-to-open-a-pdf-file-in-android-programmatically
//https://github.com/barteksc/AndroidPdfViewer
//implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
//implementation 'com.mindorks.android:prdownloader:0.6.0'
//This below to handle double clicks...
//implementation 'com.gitlab.developerdeveloperdeveloper:androidutilslibrary:1.0.0'
}
I have already tried this:
Build: Clean > Build
Invalidate Caches / Restart
Any help is appreciated thanks!
UPDATE:
I solved this problem by adding back the jcenter() repository in the Project Gradle file which I removed because Android Studio marked is as "deprecated" (barred).
Now I get this other error, and I have no idea how to solve it:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
Any thoughts? Thanks again.
I did the same and got the same result, i solved it by Fil-> Sync project with gradle files
Alternatively, You can use JDK version < 16. I have changed my JDK version from 16 to 15 in Preferences>Build, Execution, Deployment> Build Tools > Gradle and that solved my problem.

Unresolved reference #HiltAndroidApp or any other Hilt annotation in Android

I have done everything properly but still, I can't use Hilt in my project.
build.gradle(:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
buildFeatures{
viewBinding = true
dataBinding = true
}
defaultConfig {
applicationId "com.emptysheet.pdfreader_autoscroll"
minSdkVersion 16
targetSdkVersion 29
versionCode 7
versionName "1.7"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':android-pdf-viewer')
//firebase for crashlytics
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3'
implementation 'com.google.firebase:firebase-crashlytics:17.0.1'
// for ads
implementation 'com.google.android.gms:play-services-ads:19.1.0'
// multidex
//room
implementation 'androidx.room:room-ktx:2.2.5'
kapt "androidx.room:room-compiler:2.2.5"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
//debug database
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
//support for APK less than 21
implementation 'androidx.multidex:multidex:2.0.1'
// in app billing
implementation 'com.android.billingclient:billing-ktx:3.0.0'
// Hilt
implementation "com.google.dagger:hilt-android:2.28-alpha"
kapt "com.google.dagger:hilt-android-compiler:2.28-alpha"
}
build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'
// 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
}
When I am using #HiltAndroidApp or any other Hilt annotation. It says Unresolved reference. Create annotation. I have tried re-installing Hilt but it's still not working.
I am also using Android Studio 4.0
Try the usual:
File -> Invalidate Caches / Restart ... (and click Invalidate and Restart)
From the toolbar, press 'Sync Project with Gradle Files'.
Invalidate Caches / Restart

Android Studio Kotlin Complier Error node.sym must not be null

Suddenly my android studio gradle build fails with unknown error:
java.lang.IllegalStateException: failed to analyze: com.sun.tools.javac.util.ClientCodeException: java.lang.IllegalStateException: node.sym must not be null
I tried everything like reverting my project back to previous version and invaliding cache and restart but still the error persists i don't really know what is happening:
Here is my gradle:
ext {
configuration = [
compileVersion: 27,
minSdk : 14,
targetSdk : 25,
version_code : 5,
version_name : "1.0.0"
]
libraries = [
supportVersion: '1.0.0-beta01'
]
}
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath "io.realm:realm-gradle-plugin:6.0.1"
classpath 'io.fabric.tools:gradle:1.27.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath "com.android.tools.build:gradle:${buildConfig.gradlePlugin}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.social.media.post.graphics.template.card.maker"
minSdkVersion 21
targetSdkVersion 29
versionCode 6
versionName "1.5"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.smarteist:autoimageslider:1.3.2'
implementation 'me.grantland:autofittextview:0.2.1'
//noinspection GradleCompatible
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'com.github.QuadFlask:colorpicker:0.0.13'
implementation 'com.github.kaushikthedeveloper:squarelayout:0.0.3'
implementation project(':imagelibrary')
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.intuit.ssp:ssp-android:1.0.5'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.github.MasayukiSuda:BubbleLayout:v1.2.1'
//Fuel
implementation 'com.github.kittinunf.fuel:fuel:2.2.1'
implementation 'com.github.kittinunf.fuel:fuel-android:2.2.1'
implementation 'com.github.kittinunf.fuel:fuel-gson:2.2.1'
implementation 'com.google.android.material:material:1.0.0'
//Gson
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.github.fondesa:kpermissions:2.0.2'
//Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1-eap13'
implementation 'com.isseiaoki:simplecropview:1.1.4'
implementation 'com.github.hotchemi:permissionsdispatcher:2.3.1'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1'
// all common code dependencies
implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.sujithkanna:smileyrating:1.6.8'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.github.warkiz.widget:indicatorseekbar:2.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
implementation 'com.github.Theophrast:SquareImageView:1.0.1'
//For Firebase
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//For Google Mediation
implementation 'com.google.android.gms:play-services-ads:18.2.0'
// For Fb Mediation and FB ads
implementation 'com.facebook.android:audience-network-sdk:5.6.0'
implementation 'com.google.ads.mediation:facebook:5.6.0.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
//for unzip .zip file
implementation 'com.github.ghost1372:Mzip-Android:0.4.0'
//lottie animation
implementation 'com.airbnb.android:lottie:3.0.7'
// for equal spacing around recycler view
/* implementation('com.github.thekhaeng:recycler-margin:1.2.1') {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}*/
// subscribe and in - app
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
implementation 'androidx.core:core-ktx:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//Sectioned Recyclerview
implementation 'com.github.IntruderShanky:Sectioned-RecyclerView:2.1.1'
//Ripple Effect
implementation 'com.github.traex.rippleeffect:library:1.3'
//Tagview
compile 'com.veinhorn.tagview:library:1.0.4'
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}
I had the same error, and it was related to kotlin and java files with the same name.
The issue appeared after I converted a java file to kotlin in one branch, and then merged my branches, but both files remained in the project.
The error didn't show the duplicated file name, but after adding
kapt.incremental.apt=false
to "gradle.properties" as suggested by this article:
https://medium.com/#tashpemhiwa/after-a-rather-long-hiatus-without-writing-an-article-i-have-had-recent-new-inspiration-to-start-7f1f5187ba53
after disabling incremental build, the duplicate file error appeared in my build results and I knew the duplicated file name, so I removed the java file.
I enabled incremental kapt afterwards, because incremental build is faster.
It also happened when source is set like:
sourceSets {
main {
java.srcDirs += 'build/generated/data_binding_base_class_source_out/'
}
}
And there are multiple build types. Folders in data_binding_base_class_source_out intercepts and it causes the problem.
Fix:
sourceSets {
debug {
java.srcDirs += 'build/generated/data_binding_base_class_source_out/debug/'
}
release {
java.srcDirs += 'build/generated/data_binding_base_class_source_out/release/'
}
}
I've had this issue a few times.
The only thing that has worked for me is upgrading/downgrading Android Gradle Plugin. Try using 3.5.3.
In my case, I was using 3.6.0-rc02. After downgrading to 3.5.3, the issue went away.

Kotlin the compiler warning and application cannot be executed

I have a project using androidx and kotlin, I get an error message when running the application as follows:
w: JAR runtime files in the classpath should have the same version. These files were found in the classpath:
w: /Users/arjava/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.31/98678431965f7487d6dc9b399e59b6c4b3921073/kotlin-stdlib-jre7-1.2.31.jar: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead
and one more message directed me to the directory :
.gradle / caches / modules-2 / files-2.1 / org directory. Jetbrains.kotlin / kotlin-stdlib-jre7 / and xxxxxxx
I'm really confused about this problem, even though I don't apply jre in my app.gradle, I try to delete the files and then there will be more and more.
this is my app.gradle file :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mhdfdl41.android.gotoclinic"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
androidTestImplementation "android.arch.core:core-testing:1.1.1"
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.smarteist:autoimageslider:1.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.smarteist:autoimageslider:1.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.github.humazed:RoomAsset:1.0.3'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.basgeekball:awesome-validation:1.3'
// AAC (Room, Live Data, View Model)
implementation "android.arch.persistence.room:runtime:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
kapt "android.arch.lifecycle:compiler:1.1.1"
// ViewModel and LiveData
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
//room asset access databases
implementation 'com.github.humazed:RoomAsset:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation "androidx.test.ext:junit:1.1.0"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//anko
implementation "org.jetbrains.anko:anko:$anko_version"
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
repositories{
mavenCentral()
}
what made this happen?
This is how the root project's build.gradle should look alike. when I add kotlin-stdlib-jdk7, it still complains about a version mismatch; only kotlin-stdlib (without the postfix) works for me.
buildscript {
ext.kotlinVersion = "1.3.30"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.3.30"
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
}
...

Categories

Resources