You must process the Scoring Code JARs to enable more complex functionality.
DataRobot provides a tool: scoring-code-jar-tool that will process one or more Scoring Code JAR files to be able to accomplish the following goals.
scoring-code-jar-tool is distributed as a JAR file and can be obtained here.
It is not possible to use more than one Scoring Code JAR in the same Android project.
Each Scoring Code JAR contains the same dependencies and Android does not allow multiple classes with the same fully qualified name.
To fix this, scoring-code-jar-tool can be used to take multiple input JAR files and merge them into a single JAR file with duplicate classes removed.
To dynamically load scoring code jars, they must be compiled into Dalvik Executable (DEX) format.
scoring-code-jar-tool can compile to dex using the --dex parameter.
In this example, a model with id 5ebbeb5119916f739492a021 has been processed by scoring-code-jar-tool with the --dex argument to produce an output JAR called model-dex.jar.
For the sake of this example, the merged JAR file has been added as asset to the project.
It is not possible to get a filesystem path to assets which is why the asset is copied to a location in the filesystem before it is loaded.