# Android nd4j not work？

**URL:** <https://community.konduit.ai/t/android-nd4j-not-work/1367>\
**Category:** DL4J\
**Created:** [May 6, 2021, 9:24am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367 "2021-05-06T09:24:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![qq12cvhj](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/qq12cvhj/32/188_2.png) [@qq12cvhj](https://community.konduit.ai/u/qq12cvhj)\
**Post date:** [May 6, 2021, 9:24am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/1 "2021-05-06T09:24:42Z")

</div>

Hi,I’m here again. I’m working on Android ,using ND4J and DL4J.However the Nd4j not work,here are the exception stack.

```
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
W/System.err: Warning: Version of org.bytedeco:openblas could not be found.
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/linker: normalize_path - invalid input: "lib/", the input path should be absolute
W/linker: Warning: unable to normalize "lib/" (ignoring)
E/AndroidRuntime: FATAL EXCEPTION: Thread-2
    Process: com.qq12cvhj.karaoke, PID: 12394
    java.lang.ExceptionInInitializerError
        at org.nd4j.nativeblas.NativeOpsHolder.getInstance(NativeOpsHolder.java:119)
        at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.<init>(NativeOpExecutioner.java:86)
        at java.lang.Class.newInstance(Native Method)
        at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5178)
        at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092)
        at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270)
        at org.nd4j.linalg.factory.Nd4j.createFromArray(Nd4j.java:5995)
        at com.dkzy.extractor.Extractor.extractorInternal(Extractor.java:37)
        at com.dkzy.extractor.Extractor.extract(Extractor.java:83)
        at com.qq12cvhj.karaoke.MainActivity.pretreatAudioFile(MainActivity.java:101)
        at com.qq12cvhj.karaoke.MainActivity.access$100(MainActivity.java:34)
        at com.qq12cvhj.karaoke.MainActivity$2.run(MainActivity.java:117)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.RuntimeException: ND4J is probably missing dependencies. For more information, please refer to: https://deeplearning4j.konduit.ai/nd4j/backend
        at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:112)
        at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:35)
        at org.nd4j.nativeblas.NativeOpsHolder.getInstance(NativeOpsHolder.java:119) 
        at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.<init>(NativeOpExecutioner.java:86) 
        at java.lang.Class.newInstance(Native Method) 
        at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5178) 
        at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092) 
        at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270) 
        at org.nd4j.linalg.factory.Nd4j.createFromArray(Nd4j.java:5995) 
        at com.dkzy.extractor.Extractor.extractorInternal(Extractor.java:37) 
        at com.dkzy.extractor.Extractor.extract(Extractor.java:83) 
        at com.qq12cvhj.karaoke.MainActivity.pretreatAudioFile(MainActivity.java:101) 
        at com.qq12cvhj.karaoke.MainActivity.access$100(MainActivity.java:34) 
        at com.qq12cvhj.karaoke.MainActivity$2.run(MainActivity.java:117) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1669)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1631)
        at org.bytedeco.javacpp.Loader.load(Loader.java:1265)
        at org.bytedeco.javacpp.Loader.load(Loader.java:1109)
        at org.nd4j.nativeblas.Nd4jCpu.<clinit>(Nd4jCpu.java:14)
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:85)
        at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:35) 
        at org.nd4j.nativeblas.NativeOpsHolder.getInstance(NativeOpsHolder.java:119) 
        at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.<init>(NativeOpExecutioner.java:86) 
        at java.lang.Class.newInstance(Native Method) 
        at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5178) 
        at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092) 
        at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270) 
        at org.nd4j.linalg.factory.Nd4j.createFromArray(Nd4j.java:5995) 
        at com.dkzy.extractor.Extractor.extractorInternal(Extractor.java:37) 
        at com.dkzy.extractor.Extractor.extract(Extractor.java:83) 
        at com.qq12cvhj.karaoke.MainActivity.pretreatAudioFile(MainActivity.java:101) 
        at com.qq12cvhj.karaoke.MainActivity.access$100(MainActivity.java:34) 
        at com.qq12cvhj.karaoke.MainActivity$2.run(MainActivity.java:117) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1669)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1631)
        at org.bytedeco.javacpp.Loader.load(Loader.java:1213)
        at org.bytedeco.javacpp.Loader.load(Loader.java:1109) 
        at org.nd4j.nativeblas.Nd4jCpu.<clinit>(Nd4jCpu.java:14) 
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:85) 
        at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:35) 
        at org.nd4j.nativeblas.NativeOpsHolder.getInstance(NativeOpsHolder.java:119) 
        at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.<init>(NativeOpExecutioner.java:86) 
        at java.lang.Class.newInstance(Native Method) 
        at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5178) 
        at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092) 
        at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270) 
        at org.nd4j.linalg.factory.Nd4j.createFromArray(Nd4j.java:5995) 
        at com.dkzy.extractor.Extractor.extractorInternal(Extractor.java:37) 
        at com.dkzy.extractor.Extractor.extract(Extractor.java:83) 
        at com.qq12cvhj.karaoke.MainActivity.pretreatAudioFile(MainActivity.java:101) 
        at com.qq12cvhj.karaoke.MainActivity.access$100(MainActivity.java:34) 
        at com.qq12cvhj.karaoke.MainActivity$2.run(MainActivity.java:117) 
        at java.lang.Thread.run(Thread.java:764) 
I/Process: Sending signal. PID: 12394 SIG: 9

```

Oh,and there’s just one line code:

> INDArray wav = Nd4j.createFromArray(wavData);

I’m working on Android,the gradle config is the same as [here.](https://github.com/eclipse/deeplearning4j-examples/blob/master/android-examples/app/build.gradle)

Did this [problem](https://community.konduit.ai/t/error-in-jvm-when-get-output-from-keras-model/528/7) solved?

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [May 6, 2021, 9:37am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/2 "2021-05-06T09:37:00Z")

</div>

It looks like @agibsonccc was a bit over enthusiastic when reverting a change he made.

Because of a bug in beta7, Android requires a snapshot version.

The build.grade file should have these versions instead: [deeplearning4j-examples/build.gradle at 2bdc1c180986a45cfe83ddccbb226857d4c44c42 · eclipse/deeplearning4j-examples · GitHub](https://github.com/eclipse/deeplearning4j-examples/blob/2bdc1c180986a45cfe83ddccbb226857d4c44c42/android-examples/app/build.gradle)

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [May 6, 2021, 9:50am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/3 "2021-05-06T09:50:06Z")

</div>

Ah thanks for flagging @treo let me get that fixed. Thanks!

---

<div class="post-metadata">

**Author:** ![qq12cvhj](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/qq12cvhj/32/188_2.png) [@qq12cvhj](https://community.konduit.ai/u/qq12cvhj)\
**Post date:** [May 6, 2021, 9:56am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/4 "2021-05-06T09:56:31Z")

</div>

I got this,

> Could not resolve all files for configuration ‘:BgmExtractor:debugCompileClasspath’.
> 
> > Could not find nd4j-native-1.0.0-SNAPSHOT-android-arm.jar (org.nd4j:nd4j-native:1.0.0-SNAPSHOT:20210503.021213-21458).  
> > Searched in the following locations:  
> > [https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-arm.jar](https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-arm.jar)  
> > Could not find nd4j-native-1.0.0-SNAPSHOT-android-arm64.jar (org.nd4j:nd4j-native:1.0.0-SNAPSHOT:20210503.021213-21458).  
> > Searched in the following locations:  
> > [https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-arm64.jar](https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-arm64.jar)  
> > Could not find nd4j-native-1.0.0-SNAPSHOT-android-x86.jar (org.nd4j:nd4j-native:1.0.0-SNAPSHOT:20210503.021213-21458).  
> > Searched in the following locations:  
> > [https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-x86.jar](https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-x86.jar)  
> > Could not find nd4j-native-1.0.0-SNAPSHOT-android-x86\_64.jar (org.nd4j:nd4j-native:1.0.0-SNAPSHOT:20210503.021213-21458).  
> > Searched in the following locations:  
> > [https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-x86\_64.jar](https://oss.sonatype.org/content/repositories/snapshots/org/nd4j/nd4j-native/1.0.0-SNAPSHOT/nd4j-native-1.0.0-20210503.021213-21458-android-x86_64.jar)

Is these native related jars available?Can I just replace these nonexistance jars with the version of 1.0.0-beta7?

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [May 6, 2021, 10:10am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/5 "2021-05-06T10:10:28Z")

</div>

@qq12cvhj using nd4j-native wait rot this build to complete: [.github/workflows/build-deploy-android-arm32.yml · eclipse/deeplearning4j@939344a · GitHub](https://github.com/eclipse/deeplearning4j/actions/runs/816447416)  
Here’s how to configure snapshots:  
[https://deeplearning4j.konduit.ai/config/config-snapshots](https://deeplearning4j.konduit.ai/config/config-snapshots)

---

<div class="post-metadata">

**Author:** ![mili](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/mili/32/1216_2.png) [@mili](https://community.konduit.ai/u/mili)\
**Post date:** [October 9, 2023, 6:27am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/6 "2023-10-09T06:27:39Z")

</div>

These contents have been deleted and I have this problem too. Can you help me?

plugins {  
id ‘com.android.application’  
}

android {  
packagingOptions {  
exclude ‘META-INF/native-image/ **/**.json’  
exclude ‘META-INF/native-image/\*.json’  
pickFirst ‘nd4j-native.properties’  
}  
namespace ‘com.test.deeplearning’  
compileSdk 33  
ndkVersion “21.4.7075529”

```
externalNativeBuild {
    cmake {
        version "3.27.6"

```

// abiFilters = ‘armeabi-v7a’  
}  
}  
splits {  
abi {  
enable true  
reset()  
include ‘armeabi-v7a’,‘arm64-v8a’,‘x86’,‘x86\_64’  
universalApk false  
}  
}  
defaultConfig {  
applicationId “com.patoghjobs.aiSearch”  
minSdk 29  
targetSdk 33  
versionCode 1  
versionName “1.0”  
// ndk {  
// abiFilters ‘armeabi-v7a’, ‘arm64-v8a’, ‘x86’, ‘x86\_64’  
// }  
testInstrumentationRunner “androidx.test.runner.AndroidJUnitRunner”  
}

```
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

```

}

dependencies {  
// implementation ‘com.microsoft.onnxruntime:onnxruntime:1.16.0’  
implementation ‘com.microsoft.onnxruntime:onnxruntime-android:1.16.0’  
implementation ‘com.microsoft.onnxruntime:onnxruntime-extensions-android:0.9.0’  
implementation ‘org.tensorflow:tensorflow-lite:2.14.0’  
def dl4jVersion = ‘1.0.0-M2’  
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 ‘androidx.appcompat:appcompat:1.6.1’  
implementation ‘com.google.android.material:material:1.9.0’  
implementation ‘androidx.constraintlayout:constraintlayout:2.1.4’  
testImplementation ‘junit:junit:4.13.2’  
androidTestImplementation ‘androidx.test.ext:junit:1.1.5’  
androidTestImplementation ‘androidx.test.espresso:espresso-core:3.5.1’  
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’  
exclude group: ‘org.deeplearning4j’, module: ‘resources’  
}  
implementation ‘org.nd4j:nd4j-native:1.0.0-beta7’  
implementation group: ‘org.nd4j’, name: ‘nd4j-native’, version: dl4jVersion, classifier: “android-arm”  
implementation group: ‘org.nd4j’, name: ‘nd4j-native’, version: dl4jVersion, classifier: “android-arm64”  
implementation group: ‘org.nd4j’, name: ‘nd4j-native’, version: dl4jVersion, classifier: “android-x86”  
implementation group: ‘org.nd4j’, name: ‘nd4j-native’, version: dl4jVersion, classifier: “android-x86\_64”  
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: ‘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”

```
implementation 'org.tensorflow:tensorflow-lite:0.1.100'
implementation 'com.alibaba:fastjson:2.0.28'
implementation 'com.google.code.gson:gson:2.10.1'
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'

```

}

```
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
                                                                                                Caused by: java.lang.RuntimeException: ND4J is probably missing dependencies. For more information, please refer to: https://deeplearning4j.konduit.ai/nd4j/backend
                                                                                                	at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:112)
                                                                                                	at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:35)
                                                                                                	at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.<init>(NativeOpExecutioner.java:86) 
                                                                                                	at java.lang.Class.newInstance(Native Method) 
                                                                                                	at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5178) 
                                                                                                	at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092) 
                                                                                                	at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270) 
                                                                                                	at com.patoghjobs.aiSearch.ImgFeature.toTensor(ImgFeature.java:170) 
                                                                                                	at com.patoghjobs.aiSearch.ImgFeature.preprocess(ImgFeature.java:128) 
                                                                                                	at com.patoghjobs.aiSearch.ImgFeature.getImgEmbedding(ImgFeature.java:95) 
                                                                                                	at com.patoghjobs.aiSearch.ImgFeature.getImgEmbedding(ImgFeature.java:69) 
                                                                                                	at com.patoghjobs.aiSearch.MainActivity.handleOneImage(MainActivity.java:100) 
                                                                                                	at com.patoghjobs.aiSearch.MainActivity.onCreate(MainActivity.java:76) 
                                                                                                	at android.app.Activity.performCreate(Activity.java:8516) 
                                                                                                	at android.app.Activity.performCreate(Activity.java:8480) 
                                                                                                	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1418) 
                                                                                                	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3806) 
                                                                                                	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3971) 
                                                                                                	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 
                                                                                                	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
                                                                                                	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
                                                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2389) 
                                                                                                	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                	at android.os.Looper.loopOnce(Looper.java:210) 
                                                                                                	at android.os.Looper.loop(Looper.java:299) 
                                                                                                	at android.app.ActivityThread.main(ActivityThread.java:8261) 
                                                                                                	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559) 
                                                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954) 
                                                                                                Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found: needed by /data/app/~~iG7G4DI-_lQNFLxYNPvtpA==

```

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [October 9, 2023, 6:28am UTC](https://community.konduit.ai/t/android-nd4j-not-work/1367/7 "2023-10-09T06:28:56Z")

</div>

@mili can you please create a new topic and try with the most up to date verison?
