Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError: kotlin/text/Charsets #946

Closed
weiyf opened this issue Jan 30, 2021 · 4 comments
Closed

NoClassDefFoundError: kotlin/text/Charsets #946

weiyf opened this issue Jan 30, 2021 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@weiyf
Copy link

weiyf commented Jan 30, 2021

注: [ObjectBox] Starting ObjectBox processor (debug: false, incremental: true)Exception in thread "Thread-509" java.lang.NoClassDefFoundError: kotlin/text/Charsets
	at io.objectbox.reporting.BasicBuildTracker.sendEvent(BasicBuildTracker.kt:166)
	at io.objectbox.reporting.BasicBuildTracker$sendEventAsync$1.run(BasicBuildTracker.kt:143)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	... 3 more
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets

objectboxVersion 2.8.1
kotlinVersion 1.4.21
androidstudio 4.1.2

@weiyf weiyf added the bug Something isn't working label Jan 30, 2021
@greenrobot-team
Copy link
Member

greenrobot-team commented Feb 1, 2021

Thanks! Can you check that you depend on kotlin-stdlib? Your Android project should be configured like suggested at: https://developer.android.com/kotlin/add-kotlin

If that isn't the issue, please provide a small example project so we can reproduce this!

@greenrobot-team greenrobot-team added the more info required Further information is requested label Feb 1, 2021
@greenrobot-team
Copy link
Member

greenrobot-team commented Feb 1, 2021

OK, I just also got this on one of our test projects. I'm confused since kotlin.text.Charsets does still exist in Kotlin 1.4.21, as it did in the version the plugin is compiled with (1.3.72).

A fix is simple: remove usage of kotlin.text.Charsets in the plugin.

Edit: this happens sporadically when doing clean classes as part of the > Task :test-kotlin:kaptKotlin execution (e.g. use our Kotlin integ tests). The affected code should be called each time, so not sure why it only crashes unreliably.

Edit: Downgrading to the Kotlin version the plugin uses (1.3.72) has no effect. Anyhow, kotlin.text.Charsets exists since Kotlin 1.0. It really appears the whole Kotlin API is sometimes missing. Is this because this code runs in a separate thread?

@greenrobot-team greenrobot-team self-assigned this Feb 1, 2021
@greenrobot-team greenrobot-team removed the more info required Further information is requested label Feb 1, 2021
@greenrobot-team greenrobot-team added this to the 3.0 milestone Feb 1, 2021
@greenrobot-team
Copy link
Member

This is fixed internally and will ship with the next update. From what I have seen the exception is safe to ignore (it happens in a separate thread) and should not affect how the processor works or the Gradle build completes.

@greenrobot-team greenrobot-team modified the milestones: 3.0, 2.9.0 Feb 16, 2021
@greenrobot-team
Copy link
Member

With 2.9.0 this crash should no longer occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants