Android kapt java.lang.UnsatisfiedLinkError Room - android

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.

Related

Failed to resolve: customview-1.1.0

I am new to android, when compiling I get this error, it is a bit weird, because until not long ago I did not get it, and I have not made any important change in the project that I remember, and I tried to synchronize gradle, but it gives me 404 error, and I tried to find where this dependency is, because I haven't put any, so I have no idea, I'm quite confused, I thought it was going to be an easy problem to solve, but I can't find a solution, I can't do anything with the 404 error, I am using Avira VPN and Turbo VPN to connect, because without vpn it is impossible in my country, thanks to them I can develop in android, if someone could tell me if I have to add something to the gradle files or remove something I would appreciate it, I am quite stressed about it, android studio errors get over me sometimes This is all it shows me when I sync:
Failed to resolve: customview-1.1.0
Affected Modules: app
This shows me when I try to compile:
note: here is the url that gives me error:
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find customview-1.1.0.jar (androidx.customview:customview:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/customview/customview/1.1.0/customview-1.1.0.jar
gradle app
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.example.navigationrecicler"
minSdkVersion 24
targetSdkVersion 28
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.preference:preference-ktx:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
def work_version = "2.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "com.anggrayudi:storage:0.12.0"
implementation 'com.github.skydoves:progressview:1.1.2'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
implementation 'com.yarolegovich:discrete-scrollview:1.5.1'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.github.CanHub:Android-Image-Cropper:3.3.5'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
gradle proyect
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.10"
repositories {
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If your problem is with connection , then here is how to solve this
Using your proxy or psiphon , you can set the local proxy port in your setting , lets say 30001
then you can go to %USERNAME%/.gradle/gradle.properties , if the file do not exist then create one.
then you can add this to gradle.properties
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=30001
systemProp.https.proxyHost=8.36.224.208
systemProp.https.proxyPort=30001
this will make sure that all connection that gradle use , will go over the turned on proxy .
And after checking the dependencies , you dont have this dependency
runtimeOnly 'androidx.customview:customview:1.1.0'

Android POI Error when reading Microsoft Word document: Provider com.bea.xml.stream.EventFactory not found

I am trying to use Apache POI in my Android application so that I can read MS Word files. I am integrating the POIA library which enables Apache POI usage on Android (https://github.com/SUPERCILEX/poi-android). However, when I run my code and read in a Word file, I receive the following error:
org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider
com.bea.xml.stream.EventFactory not found
Below is my code (I am receiving error on the first line):
var document = XWPFDocument(uri?.let { contentResolver.openInputStream(it) });
var extractor = XWPFWordExtractor(document);
var documentText = extractor.text; // Retrieve the document's text
Below is my gradle (project-level):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
ext {
poiVersion = '3.17'
}
dependencies {
classpath 'com.android.tools:r8:1.4.93'
classpath 'com.android.tools.build:gradle:3.4.2'
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 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Below is my gradle (app-level):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.diffchecker"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// For developers using the Android Support Library
implementation 'pub.devrel:easypermissions:2.0.1'
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation "com.github.SUPERCILEX.poi-android:poi:$poiVersion"
}
Below is the full stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.diffchecker, PID: 2292
org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found
at org.apache.poi.javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at org.apache.poi.javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:97)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:116)
at com.example.diffchecker.MainActivity.onActivityResult(MainActivity.kt:249)
at android.app.Activity.dispatchActivityResult(Activity.java:7759)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4598)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4647)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7045)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
I managed to run ann app having a configuration similar to yours successfully.
Firstly, I excluded stax from poi-android because it may be outdated (and thus cause the issue) it's not actually required anymore for Java 6 and higher.
app/build.gradle
implementation ("com.github.SUPERCILEX.poi-android:poi:$poiVersion") {
exclude group: 'stax', module: 'stax-api'
}
Secondly, in my Application class, I updated 3 system properties as follows:
MainApplication.kt
override fun onCreate() {
super.onCreate()
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory", "com.fasterxml.aalto.stax.InputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl")
...
}
Finally, I built and ran the app -> it opened successfully.
Included Aalto, an open-source JSR173 provider by adding this to app's gradle
implementation group: 'com.fasterxml', name: 'aalto-xml', version: '1.0.0'
Then POI to use Aalto with the following code (Put this in my Application's onCreate(), but I assume anywhere else before using Poiji is fine as well.
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory","com.fasterxml.aalto.stax.InputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl");
And now my app is correctly reading XLSX files
This is a common issue on Android, because this Java class is not supported:
Provider com.bea.xml.stream.EventFactory not found.
You'll have to add com.fasterxml:aalto-xml and exclude stax2-api-4.1.jar:
// implementation "com.fasterxml:aalto-xml:1.1.0"
implementation ("com.github.SUPERCILEX.poi-android:poi:3.17" {
exclude group: "org.codehaus.woodstox", module: "stax2-api"
}
And then update the system-properties:
init {
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory", "com.fasterxml.aalto.stax.InputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl")
}
In Java this would be the static keyword. In Kotlin on init should still be early enough.

Android app only crashes when installed from App store in production: Resource not found in classpath: kotlin/kotlin.kotlin_builtins

I made an Android app that works fine when run locally and worked when installed from an internal test track but once I released it to production the public version installed from the Google Play Store crashes instantly when opened.
Stack trace from logcat:
--------- beginning of crash
2019-04-07 08:52:53.918 806-806/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.alexmojaki.quiggles, PID: 806
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alexmojaki.quiggles/com.alexmojaki.quiggles.MainMenuActivity}: java.lang.IllegalStateException: Resource not found in classpath: kotlin/kotlin.kotlin_builtins
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.IllegalStateException: Resource not found in classpath: kotlin/kotlin.kotlin_builtins
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl.createBuiltInPackageFragmentProvider(BuiltInsLoaderImpl.kt:55)
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl.createPackageFragmentProvider(BuiltInsLoaderImpl.kt:33)
at kotlin.reflect.jvm.internal.impl.builtins.KotlinBuiltIns.createBuiltInsModule(KotlinBuiltIns.java:127)
at kotlin.reflect.jvm.internal.impl.builtins.jvm.JvmBuiltIns.<init>(JvmBuiltIns.kt:43)
at kotlin.reflect.jvm.internal.impl.builtins.jvm.JvmBuiltIns.<init>(JvmBuiltIns.kt:18)
at kotlin.reflect.jvm.internal.components.RuntimeModuleData$Companion.create(RuntimeModuleData.kt:58)
at kotlin.reflect.jvm.internal.ModuleByClassLoaderKt.getOrCreateModule(moduleByClassLoader.kt:58)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:37)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:34)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data.getModuleData(KDeclarationContainerImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:47)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:179)
at kotlin.reflect.jvm.internal.KClassImpl.getConstructorDescriptors(KClassImpl.kt:196)
at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:91)
at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getConstructors(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl.getConstructors(KClassImpl.kt:235)
at kotlin.reflect.jvm.ReflectJvmMapping.getKotlinFunction(ReflectJvmMapping.kt:149)
at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findKotlinParameterName(KotlinModule.kt:180)
at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findImplicitPropertyName(KotlinModule.kt:106)
at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findImplicitPropertyName(AnnotationIntrospectorPair.java:490)
2019-04-07 08:52:53.919 806-806/? E/AndroidRuntime: at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreatorParam(POJOPropertiesCollector.java:485)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreators(POJOPropertiesCollector.java:465)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:313)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getPropertyMap(POJOPropertiesCollector.java:287)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getProperties(POJOPropertiesCollector.java:170)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription._properties(BasicBeanDescription.java:164)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findProperties(BasicBeanDescription.java:239)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._findCreatorsFromProperties(BasicDeserializerFactory.java:349)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:333)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:257)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:214)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:137)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:411)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:444)
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:194)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:113)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:97)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:254)
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:68)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
at com.alexmojaki.quiggles.MainMenuActivity.onCreate(MainMenuActivity.kt:140)
at com.alexmojaki.quiggles.CommonActivity.onCreate(CommonActivity.kt:47)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
... 9 more
Source code: https://github.com/alexmojaki/quiggles
Play store: https://play.google.com/store/apps/details?id=com.alexmojaki.quiggles
I use Android Studio to generate a signed Android App Bundle which I upload to the Play Console.
Android Studio version:
Android Studio 3.3.1
Build #AI-182.5107.16.33.5264788, built on January 29, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
Root build.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 "https://jitpack.io" }
maven { url "http://dl.bintray.com/waynejo/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.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()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.alexmojaki.quiggles"
minSdkVersion 21
targetSdkVersion 28
versionCode 5
versionName "public_2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
multiDexEnabled true
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.QuadFlask:colorpicker:0.0.13'
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
implementation 'com.waynejo:androidndkgif:0.3.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
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'
}
This has been fixed. Upgrading from com.android.tools.build:gradle:3.3.1 to 3.3.2 seems to have done it.
Alternatively it's possible that disabling proguard fixed the issue but that I didn't correctly install that version with that fix (although I think I did) or that something else changed (maybe on Google Play). I have no visibility into what's going on or easy tests to perform.

Android Studio “IDE error occured” after update

My app worked fine but after running it a few times I got a problem with the gradle build. (Android Studio: failed to complete gradle execution, cause is empty) i've restarted my computer and before trying to fix the issue it showed me that I have an update for a few thing in android studio. After the update it asked me to update some versions of implementation in the gradle and then the "com.google.gms:google-services" version in the project gradle. After doing so I get an error saying "IDE error occured" when trying to do a build.
The exception is occuring in the Android Support Plugin.
The exception details:
null
java.lang.NullPointerException
at com.android.tools.idea.run.tasks.InstantRunNotificationTask.<init>(InstantRunNotificationTask.java:64)
at com.android.tools.idea.fd.InstantRunBuildAnalyzer.getNotificationTask(InstantRunBuildAnalyzer.java:188)
at com.android.tools.idea.run.AndroidLaunchTasksProvider.getTasks(AndroidLaunchTasksProvider.java:122)
at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:102)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:713)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Project gradle:
// 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.1.0'
classpath 'com.google.gms:google-services:3.2.1' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.example.elaymac.randochat'
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
Thanks!
I solved the problem thanks to Severiano Jaramillo Quintanar's answer!
I faced the exact same problem, I was afraid I broke something... I
fixed it by cleaning and rebuilding the project (I had disabled
instant run as suggested here before but I guess that was not
necessary as I enabled it again after cleaning and rebuilding the
project and worked just fine...).
Build -> Clean Project
Build -> Rebuild Project
I am not sure if rebuilding would be necessary, I did both steps and
it worked fine, maybe just cleaning the project would have been
sufficient.
Hope that helps!!
EDIT
Nice, one more thing. When I solved the problem depicted here I found
another problem, when I clicked run the apk was not being created and
I solved it with my answer on that other thread:
The APK file does not exist on disk
In Android Studio:
Go to File / Invalidate caches.. /
Then select both options and restart
After restarting of Android Studio your problem is solved out

Android Support plugin errors after upgrading Android Studio to 3.1.0

I use Kotlin and databinding for my project, after recent upgrade to Android Studio 3.1.0 I constantly see a lot of exceptions in Android Support plugin:
Could not initialize class android.databinding.tool.ext.ExtKt
java.lang.NoClassDefFoundError: Could not initialize class
android.databinding.tool.ext.ExtKt at
android.databinding.tool.reflection.ModelClass.getTypeName(ModelClass.java:688)
at
android.databinding.tool.reflection.ModelClass.equals(ModelClass.java:694)
at
android.databinding.tool.reflection.ModelClass.findSetter(ModelClass.java:614)
at
android.databinding.tool.reflection.ModelClass.findGetterOrField(ModelClass.java:523)
at
com.android.tools.idea.lang.databinding.DataBindingXmlReferenceContributor$2.getReferencesByElement(DataBindingXmlReferenceContributor.java:196)
at
com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:135)
at
com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:123)
at
com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:102)
at
com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:59)
at
com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:53)
at
com.android.tools.idea.lang.databinding.DataBindingPsiElement.getReferences(DataBindingPsiElement.java:32)
at
org.intellij.plugins.intelliLang.references.InjectedReferencesContributor.getInjectedReferences(InjectedReferencesContributor.java:56)
at
org.intellij.plugins.intelliLang.references.InjectedReferencesInspection$1.visitElement(InjectedReferencesInspection.java:40)
at
com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
at
com.android.tools.idea.lang.databinding.psi.impl.PsiDbExprImpl.accept(PsiDbExprImpl.java:43)
at
com.android.tools.idea.lang.databinding.psi.impl.PsiDbRefExprImpl.accept(PsiDbRefExprImpl.java:42)
at
com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:82)
at
com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:70)
at
com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.doInspectInjectedPsi(LocalInspectionsPass.java:750)
at
com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$inspectInjectedPsi$6(LocalInspectionsPass.java:338)
at
com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:133)
at
com.intellij.concurrency.ApplierCompleter.tryToExecAllList(ApplierCompleter.java:223)
at
com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:151)
at
com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1125)
at
com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
at
com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at
com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at
com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:116)
at
com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
at
com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:143)
at
com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:229)
at
com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
at
java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at
java.util.concurrent.ForkJoinPool$WorkQueue.pollAndExecCC(ForkJoinPool.java:1190)
at
java.util.concurrent.ForkJoinPool.helpComplete(ForkJoinPool.java:1879)
at
java.util.concurrent.ForkJoinPool.awaitJoin(ForkJoinPool.java:2045)
at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:390)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719) at
java.util.concurrent.ForkJoinPool.invoke(ForkJoinPool.java:2616) at
com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:65)
at
com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:57)
at
com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspectInjectedPsi(LocalInspectionsPass.java:341)
at
com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:231)
at
com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:136)
at
com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:83)
at
com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
at
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:437)
at
com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1130)
at
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:430)
at
com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at
com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:429)
at
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:405)
at
com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:143)
at
com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:229)
at
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:403)
at
com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:170)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
My main build.gradle
buildscript {
ext.kotlin_version = '1.2.31'
ext.protobuf_version = '3.0.0'
ext.anko_version='0.10.4'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Application build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'project-report'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
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
}
}
kapt {
useBuildCache = true
mapDiagnosticLocations = true
}
dependencies {
implementation project(':proto')
implementation "android.arch.persistence.room:runtime:1.0.0"
implementation 'com.android.support:recyclerview-v7:27.1.0'
kapt "android.arch.persistence.room:compiler:1.0.0"
kapt "com.android.databinding:compiler:3.1.0"
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:common-java8:1.1.1"
implementation 'com.auth0.android:jwtdecode:1.1.1'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
// Anko
implementation "org.jetbrains.anko:anko-sdk15:$anko_version"
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:support-vector-drawable:27.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'
//noinspection GradleDependency
androidTestImplementation 'org.exparity:hamcrest-date:1.1.0'
}
And gradle.properties
org.gradle.jvmargs=-Xmx2048m
kotlin.incremental.usePreciseJavaTracking=true
android.enableD8=true
android.databinding.enableV2=true
gradle-wrapper.properties
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
So far I have tried:
Invalidate cache and restart
Reimport project
Clean and rebuid
Clean install without former configurations + reimport project + no extra plugins installed
In gradle.properties commenting out each line by one or all of them + invalidate and restart
Tried implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" in gradle "just in case"
Nothing helped and errors still pop up almost in each file. As I can see this somehow is related to binding and kotlin.
Did anyone encounter this issue?
PS
In layout xml files non-existing string resources are not even highlighted, e.g. #string/non_existing_title - just appears as a valid string resource (even after clean install).
Though I'm not sure if this issue is related to reported exceptions.
UPDATE 1
I noticed that after Invalidate & restart another exception is thrown once:
com/squareup/javapoet/TypeName
java.lang.NoClassDefFoundError: com/squareup/javapoet/TypeName
at android.databinding.tool.ext.ExtKt.<clinit>(ext.kt:180)
at android.databinding.tool.reflection.ModelClass.getTypeName(ModelClass.java:688)
at android.databinding.tool.reflection.ModelClass.equals(ModelClass.java:694)
at android.databinding.tool.reflection.ModelClass.findSetter(ModelClass.java:614)
at android.databinding.tool.reflection.ModelClass.findGetterOrField(ModelClass.java:523)
....
Caused by: java.lang.ClassNotFoundException: com.squareup.javapoet.TypeName PluginClassLoader[org.jetbrains.android, 10.3.1] com.intellij.ide.plugins.cl.PluginClassLoader#19c41e97
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 63 more
I've tried to add javapoet dependency but this exception is still thrown once after invalidating. And then only Could not initialize class android.databinding.tool.ext.ExtKt exceptions are thrown as reported initially.
After some hesitations I decided to move to canary channel and installed Android Studio Canary 10 (importing previous settings), and now specifications are:
Android Studio 3.2 Canary 10 Build #AI-181.2784.17.32.4705630, built on April 7, 2018
JRE: 1.8.0_152-release-1136-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.13.0-38-generic
On installing I had multiple issues with kotlin not finding many classes; invalidate and restart, clean/rebuild didn't help.
Then I just uninstalled Kotlin plugin from Plugins section and it looks like after restart it was restored with original version and I have no problems since.
Current Kotlin plugin version: Version: 1.2.31-Studio3.2-1
And at last everything works as expected. #Yazazzello, thanks for your feedback on Android Studio Canary #10.

Categories

Resources