I have been having for a long time this problem: I cannot upgraded the gradle version and kotlin gradle plugin in my app in Android Studio, the only solution that I can think of is to start a project from scratch and move one by one every class.
My app uses Room and therefore kapt as annotation process. With this version of kotlin and gradle everything works perfectly:
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50'
my app gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
//Kapt is the annotation processor of kotlin, all the generated code Ex. #Room depends of it
apply plugin: 'kotlin-kapt'
kapt {
generateStubs = true
correctErrorTypes = true
mapDiagnosticLocations = true
javacOptions {
// Increase the max count of errors from annotation processors.
// Default is 100.
option("-Xmaxerrs", 700)
}
}
android {
signingConfigs {
Default {
...
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.android.expenses"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.Default
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
sourceSets {
// Adds exported schema location as test app assets.
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
buildTypes {
debug {
....
}
release {
....
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
//To avoid duplicate class clash
exclude group: 'com.google.guava', module: 'listenablefuture'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
//Para parcelize y autobinding in kotlin
androidExtensions {
experimental = true
}
kotlinOptions {
jvmTarget = '1.8'
}
//De databinding, y kotlinx
/*dataBinding {
enabled = true
}*/
//Substitule to 3 line above with this
android.buildFeatures.dataBinding true
}
dependencies {
//version definition
def room_version = "2.2.5"
implementation fileTree(include: ['*.jar'], dir: 'libs')
//androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
//})
testImplementation 'junit:junit:4.12'
// Required for instrumented tests
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
//Architecture
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'joda-time:joda-time:2.7'
implementation 'org.joda:joda-money:0.10.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.neovisionaries:nv-i18n:1.15'
implementation 'de.hdodenhof:circleimageview:2.2.0'
//ColorPicker
implementation 'com.jaredrummler:colorpicker:1.1.0'
//Image Cropper
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
// Google Sheet API y Google Drive
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'pub.devrel:easypermissions:3.0.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
// Google Sheet API
implementation('com.google.apis:google-api-services-sheets:v4-rev504-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
// Google Drive Rest
implementation('com.google.apis:google-api-services-drive:v3-rev102-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
//Google Drive Android
implementation "com.google.android.gms:play-services-drive:$rootProject.playServices_version"
//Google Maps
implementation "com.google.android.gms:play-services-location:$rootProject.playServices_version"
implementation 'com.google.android.gms:play-services-maps:16.1.0'
//Google Maps Utils
implementation 'com.google.maps.android:android-maps-utils:0.5'
//Google Places
implementation "com.google.android.gms:play-services-places:$rootProject.playServices_version"
//MultiViewAdapter para mejores recyclerviews
implementation 'com.github.devahamed:multi-view-adapter:1.2.6'
implementation 'com.github.devahamed:multi-view-adapter-databinding:1.2.6'
//CardView
implementation 'androidx.cardview:cardview:1.0.0'
//PagerSlidingTabStrip
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
//Room
implementation "androidx.room:room-runtime:$room_version"
//annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - Kotlin Extensions and Coroutines support for Room
//implementation "androidx.room:room-ktx:$room_version"
// Test helpers
androidTestImplementation "androidx.room:room-testing:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// Lifecycle components
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.3.1'
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.1'
//Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
// RxJava support for Room
implementation 'androidx.room:room-rxjava2:2.0.0'
//Android Palette API
implementation 'androidx.palette:palette:1.0.0'
//Welcome Activity
implementation 'com.github.AppIntro:AppIntro:6.1.0'
//Charts
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
//TableView
implementation 'com.evrencoskun.library:tableview:0.8.8'
//Anko Commons Library for easier development
implementation "org.jetbrains.anko:anko-commons:$anko_version"
//Search Dialog
implementation 'com.github.mirrajabi:search-dialog:1.2.4'
//FAB Button Speed Dial
implementation 'com.leinardi.android:speed-dial:3.2.0'
//WorkManager
implementation('androidx.work:work-runtime-ktx:2.0.1') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
//PagingList
implementation 'androidx.paging:paging-runtime:2.1.0'
//Calendar
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'
//Image Compressing
implementation 'id.zelory:compressor:3.0.1'
//New Places: Old one is deprecated
implementation 'com.google.android.libraries.places:places:2.4.0'
// Koin for Android
implementation 'org.koin:koin-android:2.0.0-rc-2'
implementation 'org.koin:koin-android-viewmodel:2.0.0-rc-2'
// KTX
implementation 'androidx.core:core-ktx:1.3.2'
// Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
// Moshi
implementation 'com.squareup.moshi:moshi:1.8.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.8.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1'
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//SQLCipher
implementation "net.zetetic:android-database-sqlcipher:4.4.0#aar"
....
}
repositories {
mavenCentral()
}
// For Firebase
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
I tried to update to the current newest version of each, although this problem exists in not so new versions
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
In order to make this change I did the following:
Update Java jdk to 11
Replace kotlin-android-extensions with 'kotlin-parcelize' and viewBinding = true
Remove androidExtensions: experimental=true
Replace the parcelize import with kotlinx.parcelize.Parcelize
Even all this, I still have this error
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)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
There are messages below app:kaptDebugKotlin but they are warnings of multiple constructors of non #Entity classes which shouldn't provoke the crash
This is really frustrating cause I don't know what else to do or how to get more information (I also did a run with --info and I only get the same output from kapt)
Thank you in advance for your time and help
UPDATE
Here is my top gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//ext.kotlin_version = '1.4.10'
//Working version
ext.kotlin_version = '1.3.50'
//Latest version
//ext.kotlin_version = '1.5.20'
//ext.kotlin_version = '1.3.41'
repositories {
mavenCentral()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
//jcenter()
}
dependencies {
// working version, if change modify distributionUrl in gradle-wrapper.properties
classpath 'com.android.tools.build:gradle:4.0.2'
// to upgrade
//classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
//De MaterialChipsInput y Search Dialog
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext{
archLifecycleVersion = '1.1.1'
anko_version='0.10.5'
support_version = '28.0.0'
playServices_version = '16.0.0'
}
Quick update, when I try to upgrade only the room version to 2.3.0 the error occurs:
[kapt] An exception occurred: java.lang.NoSuchMethodError: kotlin.jvm.internal.FunctionReferenceImpl.<init>(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
at androidx.room.log.RLog$CollectingMessager$writeTo$printMessage$1.<init>(RLog.kt)
at androidx.room.log.RLog$CollectingMessager.writeTo(RLog.kt:92)
at androidx.room.solver.TypeAdapterStore.findRowAdapter(TypeAdapterStore.kt:520)
at androidx.room.solver.TypeAdapterStore.findQueryResultAdapter(TypeAdapterStore.kt:459)
at androidx.room.solver.binderprovider.InstantQueryResultBinderProvider.provide(InstantQueryResultBinderProvider.kt:29)
at androidx.room.solver.TypeAdapterStore.findQueryResultBinder(TypeAdapterStore.kt:391)
at androidx.room.processor.DefaultMethodProcessorDelegate.findResultBinder(MethodProcessorDelegate.kt:140)
at androidx.room.processor.InternalQueryProcessor.getQueryMethod(QueryMethodProcessor.kt:204)
at androidx.room.processor.InternalQueryProcessor.processQuery(QueryMethodProcessor.kt:135)
at androidx.room.processor.QueryMethodProcessor$process$1.invoke(QueryMethodProcessor.kt:67)
at androidx.room.processor.QueryMethodProcessor$process$1.invoke(QueryMethodProcessor.kt:37)
at androidx.room.processor.Context.collectLogs(Context.kt:133)
at androidx.room.processor.QueryMethodProcessor.process(QueryMethodProcessor.kt:61)
at androidx.room.processor.DaoProcessor.process(DaoProcessor.kt:99)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:100)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:51)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:47)
at androidx.room.compiler.processing.JavacProcessingStepDelegate.process(XProcessingStep.kt:111)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:79)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:35)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:230)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:188)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1558)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Any idea why and is it related?
SOLUTION:
In case anyone is searching for something similar, I finally redid the project and the problem was related with moshi kapt. I update the library to 1.12.0 and everything works
In my case, I have faced the same issue while I have upgraded "kotlin-gradle-plugin: from 1.5.31 to 1.6.10".
I have solved this issue by Upgrading Gradle Version to the latest version by following official docs.
In android studio got to File>Project Structure>Project>Gradle Version here select the latest version of Gradel.
I think, This happens when we update "kotlin-gradle-plugin" and the other dependencies are not the latest version.
Also, Check your JDK version you can follow official docs.
Upgrade room to 2.4.0-beta02 will fix your problem. Because it fix mine.
We've added a new TypeConverter analyzer that takes nullability information in types into account. As this information is only available in KSP, it is turned on by default only in KSP. If it causes any issues, you can turn it off by passing room.useNullAwareTypeAnalysis=false to the annotation processor. If that happens, please a file bug as this flag will be removed in the future. With this new TypeConverter analyzer, it is suggested to only provide non-null receiving TypeConverters as the new analyzer has the ability to wrap them with a null check. Note that this has no impact for users using KAPT or Java as the annotation processors (unlike KSP), don't have nullability information in types. (Ia88f9, b/193437407)
https://developer.android.com/jetpack/androidx/releases/room#2.4.0-beta02
In your dependencies below the //Room comment add the following :
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
and make sure you are using latest room_version = [2.3.0]
Related
The error goes on to say "Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!)."
It is not obvious to me how to "fix" the configuration. I added the suggested flag, but it does not resolve and fails on its own.
The IDE is Dolphin Android Studio Dolphin | 2021.3.1
The project sets the Kotlin version:
buildscript {
ext.kotlin_version = '1.6.10'
I previously set the project to use Kotlin 1.7.10 here, but downgraded in the vain hope it would solve the issue, but it does not.
I tried adding an explicit dependency on androidx.compose.compiler:compiler which appears to be silently ignored.
I do not see where Kotlin 1.6.21 and Compose Compiler 1.2.0-alpha05 are being set, as neither is set in the build files.
I'm familiar with Android, but not Compose. I am using the current stable IDE and dependency statements taken directly from the Compose documentation, and yet the project fails to build.
I suspect there is some magic combination of dependency versions needed to use Compose in Dolphin, but I have not been able to find it.
I tried Compose at v1.0 but had to back out again as there were so many issues, and it seems it is still challenging to work with, but perhaps some kind soul will point out my error and then I will happily apologise to our friends at Google. :-)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'com.google.firebase.crashlytics'
android {
namespace "com.blah"
compileSdk 33
defaultConfig {
applicationId "com.blah"
minSdk 21
targetSdk 33
versionCode 123
versionName "1.2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "environment"
productFlavors {
staging {
dimension "environment"
applicationIdSuffix ".staging"
}
production {
dimension "environment"
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "MyApp-${variant.versionName}-${variant.name}.apk"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
buildFeatures {
dataBinding true
compose true
}
lint {
disable 'RtlHardcoded'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
// Android X Jetpack
implementation "androidx.appcompat:appcompat:1.5.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation 'androidx.core:core-ktx:1.9.0'
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.fragment:fragment-ktx:1.5.2"
implementation "androidx.collection:collection-ktx:1.2.0"
implementation "androidx.window:window:1.0.0"
// Jetpack Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.ui:ui-tooling:1.2.1")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation("androidx.compose.foundation:foundation:1.2.1")
implementation("androidx.compose.material:material:1.2.1")
implementation("androidx.compose.material:material-icons-core:1.2.1")
implementation("androidx.compose.material:material-icons-extended:1.2.1")
// Integration with observables
implementation("androidx.compose.runtime:runtime-livedata:1.2.1")
implementation("androidx.compose.runtime:runtime-rxjava2:1.2.1")
// Google
implementation "com.google.android.material:material:1.6.1"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
implementation "androidx.navigation:navigation-ui-ktx:2.5.2"
// Firebase & Crashlytics
implementation "com.google.firebase:firebase-core:21.1.1"
implementation "com.google.firebase:firebase-analytics:21.1.1"
implementation "com.google.firebase:firebase-crashlytics:18.2.13"
implementation "com.google.firebase:firebase-messaging:21.0.1"
// Urban Airship push messaging
implementation "com.urbanairship.android:urbanairship-fcm:13.3.5"
// Twilio (video calling)
implementation "com.twilio:video-android-ktx:7.1.1"
implementation "com.twilio:audioswitch:1.1.4"
// ExoPlayer
implementation "com.google.android.exoplayer:exoplayer-core:2.18.1"
implementation "com.google.android.exoplayer:exoplayer-ui:2.18.1"
// Third-party
implementation "com.jakewharton.timber:timber:5.0.1"
implementation "com.jakewharton.threetenabp:threetenabp:1.4.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
implementation "com.squareup.picasso:picasso:2.71828"
implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0"
// https://github.com/square/okhttp/blob/master/CHANGELOG.md
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"
// Open Source Licence List
implementation "com.github.franmontiel:AttributionPresenter:1.0.1"
// Shake to Send Feedback
implementation "com.linkedin.shaky:shaky:3.0.4"
implementation "com.jraska:falcon:2.2.0"
// Page Indicator View
implementation 'com.github.romandanylyk:PageIndicatorView:v.1.0.3'
// Testing
implementation "androidx.legacy:legacy-support-v4:1.0.0"
testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.4.0"
testImplementation "org.mockito:mockito-core:4.6.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.2.1")
apply plugin: 'com.google.gms.google-services'
}
Module build file:
apply plugin: "com.github.ben-manes.versions"
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.2"
classpath "com.google.gms:google-services:4.3.14"
classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
mavenCentral()
jcenter() {
content {
includeModule("com.google.android", "flexbox")
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In your app/build.gradle file in the android block add:
android {
//..
composeOptions {
kotlinCompilerExtensionVersion "1.3.1"
}
}
According to the compatibility map use kotlin 1.7.10
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
java.lang.reflect.InvocationTargetException (no error message)
Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
.......
Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStreams
....
Caused by: java.lang.ClassNotFoundException: org.antlr.v4.runtime.CharStreams
... 45 more
Build.gradle file (module):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.bloodwyn.userdata"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
coreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.0.9"
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//android
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.recyclerview:recyclerview:1.1.0"
// For control over item selection of both touch and mouse driven selection
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
//rxjava
implementation 'io.reactivex.rxjava3:rxjava:3.0.2'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation "com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0"
//room
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
kapt "androidx.room:room-compiler:$room_version"
//tests
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.2.0'
androidTestImplementation 'com.google.truth:truth:1.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
debugImplementation 'androidx.fragment:fragment-testing:1.2.5'
//mock http server for tests
testImplementation 'com.squareup.okhttp3:mockwebserver:4.6.0'
//room test
testImplementation "androidx.room:room-testing:$room_version"
}
build.gradle project:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I added this:
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
becouse if i dont i got the "ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1" exception
I have some suggestions that may help some folks with auto-regenerating the ANTLR4 code for use on Android with Android Studio and Gradle. A complete working example of my setup is found with my project here.
First, to answer part of the poster's question. The org.antlr:antlr4-runtime:4.5.3 and org.antlr:antlr4-tool:4.5.3 packages seem dated. Even though many older posts suggest using these dependencies. I have found that the following will include the most recent version of ANTLR4 (check the ANTLR4 repository for updated versions):
dependencies {
// ...
implementation 'org.antlr:antlr4:4.9.1'
}
With typical Android applications, we need to apply the following stock plugin first:
apply plugin: 'com.android.application'
The problem is that this breaks Gradle's use with the ANTLR4 plugin. A work around is to install the antlr4 utility in your shell path and then do something like the following in the application build.gradle configuration:
/* NOTE: The gradle plugin with Android does not work, this is a shell command within the standard system paths. */
def generateAntlrJava(String grammarFile) {
def scriptRunCmd = "antlr -o app/src/main/antlr-gen -package 'com.my.package.name' -Dlanguage=Java" +
" -listener -visitor -long-messages -lib 'path/to'" +
" -Xexact-output-dir 'path/to" + grammarFile + "'";
def cmdResult = ['bash', '-c', scriptRunCmd].execute();
cmdResult.waitFor();
return cmdResult.text
}
task PreBuildGenAntlr4JavaSources {
println 'REMOVING OLD ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).deleteDir()
println 'GENERATING ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).mkdirs()
generateAntlrJava("MyScriptLexer.g4")
generateAntlrJava("MyScriptParser.g4")
outputs.upToDateWhen { false } /* Make the task run every time (no UP-TO-DATE skippage) */
}
preBuild.dependsOn PreBuildGenAntlr4JavaSources
task cleanPreBuildGenAntlr4JavaSources {
println 'REMOVING OLD ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).deleteDir()
println 'GENERATING ANTLR4 JAVA SOURCES ==> '
file(new File('app/src/main/antlr-gen')).mkdirs()
generateAntlrJava("MyScriptLexer.g4")
generateAntlrJava("MyScriptParser.g4")
}
clean.dependsOn cleanPreBuildGenAntlr4JavaSources
That's it. The only solution that worked for my use case :)
I just integrated Kochava SDK to my app recently. While I installing or running apk first time its crashed, but its working fine while running second time! However I also checked by generating signed(released) apk and then installing manually on device then its continuously crashing!
Here is my Project gradle file:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
maven {url "http://kochava.bintray.com/maven"}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jcenter.bintray.com" }
jcenter()
google()
maven {
url 'https://maven.google.com/'
}
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
maven { url "https://jitpack.io" }
maven {url "http://kochava.bintray.com/maven"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And Module gradle file is:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
dataBinding {
enabled = true
}
defaultConfig {
applicationId "xyz.xyz.myapplication"
minSdkVersion 19
targetSdkVersion 28
versionCode 31
versionName "4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
ignoreAssetsPattern "!*ffprobe"
ignoreAssetsPattern "!*ffmpeg"
ignoreAssetsPattern "!arm"
ignoreAssetsPattern "!x86"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
android.buildTypes.each { type ->
type.buildConfigField 'String', 'Base_URL', WEBServiceBaseURL
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Android necessary...
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//Support libs...
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'commons-io:commons-io:2.6'
//Facebook ads
implementation 'com.google.ads.mediation:facebook:5.6.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.6.0'
implementation 'com.facebook.android:facebook-android-sdk:4.41.0'
//Firebase
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-ads:18.3.0'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.android.play:core:1.6.4'
//FFMPEG
implementation 'com.writingminds:FFmpegAndroid:0.3.2'
//Image crop
implementation 'com.naver.android.helloyako:imagecropview:1.2.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
//Exo Player
implementation 'com.google.android.exoplayer:exoplayer:2.10.5'
//Progress bar
implementation 'com.dinuscxj:circleprogressbar:1.3.0'
//Range seekbar
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
//Glide...
implementation 'com.github.bumptech.glide:glide:4.9.0'
//GPUImage...
implementation 'jp.co.cyberagent.android:gpuimage:2.0.3'
//Fetch a downloader library...
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4"
implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.4"
//Downloader for Android 19...
implementation 'com.mindorks.android:prdownloader:0.6.0'
//Lottie...
implementation 'com.airbnb.android:lottie:3.2.0'
//Volley for Anfroid 4!
implementation 'com.android.volley:volley:1.1.1'
//Introduction for any screen...
implementation 'com.github.paolorotolo:appintro:4.0.0'
//ViewPagerEffects...
implementation 'com.eftimoff:android-viewpager-transformers:1.0.1#aar'
//Kochava...
implementation 'com.kochava.base:tracker:3.6.3'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'com.android.installreferrer:installreferrer:1.1'
//AVLoader...
implementation 'com.wang.avi:library:2.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':jiaozivideoplayer')
}
apply plugin: 'com.google.gms.google-services'
I also implemented Application class as per suggestion and rule:
public class MyApplication extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics())
.debuggable(true)
.build();
Fabric.with(fabric);
AudienceNetworkAds.initialize(this);
AudienceNetworkAds.isInAdsProcess(this);
MobileAds.initialize(this, getString(R.string.app_id));
if (Build.VERSION.SDK_INT < 21) {
PRDownloaderConfig config = PRDownloaderConfig.newBuilder()
.setReadTimeout(30_000)
.setConnectTimeout(30_000)
.build();
PRDownloader.initialize(getApplicationContext(), config);
}
Tracker.configure(new Tracker.Configuration(getApplicationContext())
.setAppGuid("koboo-8bod4gz3")
.setLogLevel(Tracker.LOG_LEVEL_INFO)
);
}
}
Above code is OK for Kochava integration. But another thing is that, here I also need all those google and firebase sdk! So, may be its problem is in between google sdk and Kochava sdk! But I need can't remove google sdk or crashlytics and also I need to integrate Kochava for tracking my application in Ad campaign in "Tik Tok" as per its suggestion!
Well if I don't initialize Tracker.configure(....); in application class then app run fine and not crashing but then Kochava not working!
So, after initialize Tracker.configure(...); Kochava sdk it will be generate error:
2019-12-03 15:33:14.254 E/AndroidRuntime: FATAL EXCEPTION: main
Process: xyz.xyz.myapplication, PID: 6113
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/aidl/BaseStub;
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:133)
at com.kochava.base.c$a.run(Unknown Source:15)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.aidl.BaseStub" on path: DexPathList[[zip file "/data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/base.apk"],nativeLibraryDirectories=[/data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/lib/x86, /data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:133)
at com.kochava.base.c$a.run(Unknown Source:15)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
May be there is some problem in Kochava library or something I missing in integration?! Please tell me what is the problem? Or it is not suitable with google sdk?
Here is the link for Android Kochava SDK integration.
Well if you have more than one module in your app then put all Kochava dependencies in all of those module :
implementation 'com.kochava.base:tracker:3.6.3'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'com.android.installreferrer:installreferrer:1.0'
These all must be in all module level gradle files. This is not mentioned is in documentation but you can try it. Because I tried your code in my application and I also have Google ads and other Google's libraries and also have three modules in my app. But added these libraries in all modules than its work perfectly!
I don't know if you have more than one module in your app but if there is than this will helpful.
EDIT
It has been fixed by google, on the same version...
It should work now, if it's still crashing it's probably linked to the previous version being cached, the following should fix it:
implementation('com.android.installreferrer:installreferrer:1.1') { changing .= true}
More information here: https://github.com/adjust/android_sdk/issues/402
Try with com.android.installreferrer:installreferrer:1.0 instead of 1.1
Looks like IGetInstallReferrerService expects com.google.android.aidl.BaseStub in the 1.1 implementation, which does not come with installreferrer
mVck is correct and as far as we can tell, it's likely on Google's end and looks to be specific to version 1.1 of their library. This is our theory because it appears others on SO are experiencing similar issues with other vendor SDKs.
We've reached out to our Google reps to confirm, but in the meantime, please
stay on version 1.0 of Google's library as indicated above. Once we receive confirmation we'll be sure and update our support documentation. Thanks!
I just ran into the same thing and what fixed it for me was to delete the install referrer dependency from my gradle cache and then re-sync with gradle. I think it was something to do with the cached aar. It's bizarre though because it was fine earlier this week and the aar didn't change as far as I'm aware. Regardless, deleting it and re-syncing did the trick for me.
I was having trouble downgrading to 1.0 after attempting to fix this issue with the 1.1.1 fix. In my case the installreferrer was adding the permission READ_PHONE_STATE to my application. Gradle was attempting to resolve 1.1 even after I backed down the version to 1.0 in my app.gradle.
In order to fix this I now force installreferrer to use version 1.0.
dependencies {
configurations.all {
resolutionStrategy.force 'com.android.installreferrer:installreferrer:1.0'
}
implementation 'com.android.installreferrer:installreferrer:1.0'
}
I'm updating my project to use the jetpack libraries.
I executed this in the commandline:
./gradlew :app:kaptDebugKotlin
in my project directory, and this error was thrown:
e: [kapt] An exception occurred: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
at org.sqlite.core.NativeDB._open_utf8(Native Method)
at org.sqlite.core.NativeDB._open(NativeDB.java:71)
at org.sqlite.core.DB.open(DB.java:174)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:220)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:25)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at androidx.room.verifier.DatabaseVerifier$Companion.create(DatabaseVerifier.kt:81)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:78)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:54)
at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:63)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:99)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:55)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:27)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:216)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:164)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:93)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:98)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:85)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:370)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:61)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:101)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:361)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:126)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:95)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:405)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:927)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:957)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:926)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:404)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This is my project build.gradle
ext {
archLifecycleVersion = '2.0.0'
roomVersion = '2.1.0-alpha02'
pagingVersion = '2.1.0-beta01'
supportLibVersion = '1.0.0'
}
buildscript {
ext.kotlin_version = '1.2.51'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.guava:guava:19.0'
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
mavenCentral()
}
}
And this is the app build.gradle
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "package.name.of.app"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
//multiDexEnabled false
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4096m"
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.supportLibVersion"
implementation "com.google.android.material:material:$rootProject.supportLibVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// architecture components
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-runtime:$rootProject.archLifecycleVersion"
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
implementation "androidx.paging:paging-runtime:$rootProject.pagingVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
testImplementation 'junit:junit:4.12'
}
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
Does anyone know what caused this issue? Why does the SQLite error occur during compilation instead of during actual execution? Also, has anyone successfully compiled an app with similar dependencies as described above?
Upon searching for information regarding this issue, I found this link
https://github.com/xerial/sqlite-jdbc/issues/97
The fix was to update /etc/fstab to remove 'noexec' from /tmp, and then remounting /tmp
In Windows grant all permissions to your user in c:\Users\\AppData\Temp and the problem will be gone.
You'll have to do it everytime you update Windows.
If you don't have permissions to remove noexec from /tmp, you can also supply an alternative java.io.tmpdir to kapt:
A Room issue has a comment from a Google engineer with a workaround:
Since you are using kapt are you sure you are passing java.io.tmpdir to Kotlin's compiler daemon and not Gradle's?
For example:
./gradlew <gradle-params> -Dkotlin.daemon.jvm.options="-Djava.io.tmpdir=path/to/a/folder" <task>
Another Room issue has a comment from a Google engineer suggesting that upgrading to 2.2.5 fixes the problem:
Can you try with Room 2.2.5 we had some further fixes in that version regarding the JDBC library and the way the Room compiler loads it and uses it.
I upgraded to 2.2.5, and the problem went away, but I didn't see this failure on every build, so I'll have to wait couple of weeks before I can say this is definitely fixed.
For me, the problem was AdoptOpenJDK installed via Homebrew. According to this issue some versions of the JDK distributed via Homebrew are not notarized.
I solved this by uninstalling from Homebrew and re-installing AdoptOpenJDK from the .pkg file downloaded from their site.
When sync project with gradle files, Android Studio shows this error:
Android dependency 'io.reactivex.rxjava2:rxandroid' has different version for the compile (2.0.1) and runtime (2.1.0) classpath. You should manually set the same version via DependencyResolution
I have try to solve it with:
resolutionStrategy.force 'io.reactivex.rxjava2:rxandroid:2.1.0'
But with the same result.
This problem occurs when I change 'compile' with 'implementation' in the libraries definition
This is how I define the rest of the rx libraries:
buildscript {
ext.retrofitVersion = '2.4.0'
ext.rxVersion = '2.2.1'
ext.rxAndroidVersion = '2.1.0'
ext.okhttpVersion = '3.8.1'
ext.rxKotlinVersion = '2.0.0'
...
repositories {
mavenCentral()
jcenter()
}
}
//Rx & Retrofit 2 **********************************
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") {
// exclude Retrofit’s OkHttp peer-dependency module and define your own module import
exclude module: 'okhttp'
}
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}"
implementation "io.reactivex.rxjava2:rxjava:$rxVersion"
Any ideas how can I solve this problem?
Ok, finally I solved the problem following the #yayo-arellano solution. I was to replace "implementation" by "api".