doc-ai / tensorio-android

TensorIO for Android
2 stars 6 forks source link

Json schema validator is broken #171

Open phildow opened 4 years ago

phildow commented 4 years ago

See https://github.com/doc-ai/net-runner-android/issues/83

phildow commented 4 years ago

What we're getting is a class not found when we try to load the json schema validator. My hypothesis is that it's because the validator depends on Java 7 when the app targets Java 8, but I can't confirm this. We also get errors about missing dex files.

The crash only shows up in the release build. Here's how you can build for release to device from studio:

https://stackoverflow.com/questions/23979540/android-studio-deploy-the-release-apk-instead-of-debug

Dex files:

https://stackoverflow.com/questions/42897739/java-io-ioexception-no-original-dex-files-found-for-dex-location https://stackoverflow.com/questions/52269042/no-original-dex-files-found-for-dex-location/54509773

Jackson JSON:

https://github.com/fge/jackson-coreutils

Or Java 6?

sourceCompatibility = "1.6";
targetCompatibility = "1.6";

Ah, Java JSON Utils targets 1.7:

https://github.com/java-json-tools/json-schema-core/blob/master/project.gradle

Alternative validators have so far been a bust:

https://json-schema.org/implementations.html#validator-java

We can't use jackson because of target compatibility, as far as i can tell, so we want the org.json implementation but freaking android has its own implementation of that library which is not compatible with the existing schema validators:

https://github.com/everit-org/json-schema https://github.com/everit-org/json-schema/issues/209

Which is too bad because json-schema looks very nice. Maybe a fork would require only a few simple changes? Such as:

https://stackoverflow.com/questions/14306528/how-do-i-use-jsonobject-in-android

Wait but 1.10 says it has android compatibility:

https://github.com/everit-org/json-schema/releases/tag/1.10.0

phildow commented 4 years ago

Nope, still broken. As soon as we build for release on Net Runner with this code that works fine in debug builds, we get errors. I have no been able to find a json-schema validator that is compatible with android, so I'm disabling those classes and there will simply not be json validation on android for the time being.