-
Notifications
You must be signed in to change notification settings - Fork 624
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
Android API 23 crashes with NoClassDefFoundError
#989
Comments
Api 23 is android 6, from 2015. Not sure we want to do the extra mile for something that old. |
Yeah I understand that for sure. Some things to consider though:
|
Testing it now, but seems like removing logging from |
From your log it seems SLF4J loads fine: This is a standard error message when no providers are found. It seems to break afterwards, but i don't know how Android logging works with SLF4J. |
Right right. Everywhere else, logging works fine. I tested adding a debug log message upon
I have a weird feeling that it has something to do with how art (Android Run Time) handles the loading of JNI interfaces, thus the re-init failures; it does not like having I tried inlining the |
So, I wrapped the logging in a try/catch block and everything worked. try {
logger.atTrace()
.setMessage("DriverManager [{}] [SQLite EXEC] {}")
.addArgument(() -> Thread.currentThread().getName())
.addArgument(sql)
.log();
} catch (NoClassDefFoundError e) {} Still had the art: re-init failure log messages though. Going to investigate further, but it seems like the builder class returned via |
Tried crashing things on API 23 by adding the following to static {
try {
DriverManager.registerDriver(new JDBC());
logger.atTrace().setMessage("REGISTERED").log();
} catch (SQLException e) {
logger.atError().setCause(e).log();
}
} So the builder returned by |
Changed the following in /** @see org.sqlite.core.DB#_exec(java.lang.String) */
@Override
public synchronized int _exec(String sql) throws SQLException {
logger.trace("DriverManager");
// try {
// logger.atTrace()
// .setMessage("DriverManager [{}] [SQLite EXEC] {}")
// .addArgument(() -> Thread.currentThread().getName())
// .addArgument(sql)
// .log();
// } catch (NoClassDefFoundError e) {}
return _exec_utf8(stringToUtf8ByteArray(sql));
} Seems almost as if the version of |
I don't think this has anything to do with JNI. JNI is about loading native libs. SLF4J is used in the Java code. I don't know Android that well, but i'm pretty sure there's a lot of Java libraries that use SLF4J and can be used on Android. You would need to understand exactly how SLF4J works on Android, whether it's provided by the ART, or by other libraries. It may also be that the SLF4J implementation used on Android is not compatible with SLF4J 2. |
@05nelsonm |
Just ran latest release of |
Describe the bug
Android API 23 crashes because slf4j is not loaded when static call
LoggerFactory.getLogger
is made fromNativeDB
This only affects API 23, as service loaders do not work properly; API 24+ works fine.
To Reproduce
Run on emulator for Android API 23
Expected behavior
Should not crash
Logs
Environment (please complete the following information):
Android API 23
x86_64
3.43.2.0
Additional context
The text was updated successfully, but these errors were encountered: