I follow the instructions to configure on Android, but the following error will be reported:
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at android.os.Binder.execTransactInternal(Binder.java:1290)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at android.os.Binder.execTransact(Binder.java:1249)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: Caused by: java.lang.RuntimeException: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5131)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at org.nd4j.linalg.factory.Nd4j.(Nd4j.java:226)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: … 10 more
04-13 19:49:33.646 9206 9247 E AndroidRuntime: Caused by: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at org.nd4j.linalg.factory.Nd4jBackend.load(Nd4jBackend.java:218)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5128)
04-13 19:49:33.646 9206 9247 E AndroidRuntime: … 11 more
my Gradle file:
plugins {
id 'com.android.application'
}
android {
namespace 'com.dd.ai'
compileSdk 33
defaultConfig {
applicationId "com.dd.ai"
minSdk 33
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildFeatures {
viewBinding true
}
packagingOptions {
exclude 'META-INF/native-image/**/**.json'
exclude 'META-INF/native-image/*.json'
pickFirst 'nd4j-native.properties'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
// Room start
def room_version = "2.5.1"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// Room end
// Tensorflow lite dependencies
implementation 'org.tensorflow:tensorflow-lite:2.8.0'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:2.8.0'
// tf end
def dl4jVersion = '1.0.0-beta6'
def openblasVersion = '0.3.19-1.5.7'
def opencvVersion = '4.5.5-1.5.7'
def leptonicaVersion = '1.82.0-1.5.7'
implementation(group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: dl4jVersion) {
exclude group: 'org.bytedeco', module: 'opencv-platform'
exclude group: 'org.bytedeco', module: 'leptonica-platform'
exclude group: 'org.bytedeco', module: 'hdf5-platform'
exclude group: 'org.nd4j', module: 'nd4j-base64'
exclude group: 'org.nd4j', module: 'nd4j-api'
}
implementation group: 'org.nd4j', name: 'nd4j-native', version: dl4jVersion
implementation group: 'org.bytedeco', name: 'openblas', version: openblasVersion
implementation group: 'org.bytedeco', name: 'openblas', version: openblasVersion, classifier: "android-arm"
implementation group: 'org.bytedeco', name: 'openblas', version: openblasVersion, classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'openblas', version: openblasVersion, classifier: "android-x86"
implementation group: 'org.bytedeco', name: 'openblas', version: openblasVersion, classifier: "android-x86_64"
implementation group: 'org.bytedeco', name: 'opencv', version: opencvVersion
implementation group: 'org.bytedeco', name: 'opencv', version: opencvVersion, classifier: "android-arm"
implementation group: 'org.bytedeco', name: 'opencv', version: opencvVersion, classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'opencv', version: opencvVersion, classifier: "android-x86"
implementation group: 'org.bytedeco', name: 'opencv', version: opencvVersion, classifier: "android-x86_64"
implementation group: 'org.bytedeco', name: 'leptonica', version: leptonicaVersion
implementation group: 'org.bytedeco', name: 'leptonica', version: leptonicaVersion, classifier: "android-arm"
implementation group: 'org.bytedeco', name: 'leptonica', version: leptonicaVersion, classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'leptonica', version: leptonicaVersion, classifier: "android-x86"
implementation group: 'org.bytedeco', name: 'leptonica', version: leptonicaVersion, classifier: "android-x86_64"
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
// xgboost dependency
// implementation group: 'ml.dmlc', name: 'xgboost4j_2.12', version: '1.7.4'
// implementation group: 'ml.dmlc', name: 'xgboost4j_${scala.binary.version}', version: '1.7.5'
// implementation group: 'ml.dmlc', name: 'xgboost4j-spark_${scala.binary.version}', version: '1.7.5'
implementation group: 'io.github.metarank', name: 'lightgbm4j', version: '3.3.2-5'
}