# Flutter Android AppBundle issues with DL4J

**URL:** <https://community.konduit.ai/t/flutter-android-appbundle-issues-with-dl4j/3242>\
**Category:** DL4J\
**Created:** [September 10, 2024, 7:22am UTC](https://community.konduit.ai/t/flutter-android-appbundle-issues-with-dl4j/3242 "2024-09-10T07:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gmane](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/gmane/32/1316_2.png) [@Gmane](https://community.konduit.ai/u/Gmane)\
**Post date:** [September 10, 2024, 7:22am UTC](https://community.konduit.ai/t/flutter-android-appbundle-issues-with-dl4j/3242/1 "2024-09-10T07:22:05Z")

</div>

Good day, we are currently building a Flutter project for Android and we are using DL4J but when we are trying to create the app bundle we are getting an error as follows: \* What went wrong:  
Execution failed for task ‘:app:packageReleaseBundle’.

> A failure occurred while executing com.android.build.gradle.internal.tasks.PackageBundleTask$BundleToolWorkAction  
> File ‘root/lib/arm64-v8a/include/cblas.h’ uses reserved file or directory name ‘lib’.

From a previous forum post: [ND4J is conflicting with Android dependencies](https://community.konduit.ai/t/nd4j-is-conflicting-with-android-dependencies/2870) someone recommended that we use nd4j-minimal but how can we change our current dependencies to accommodate this? Our current dependencies list is also as follows:  
dependencies {  
//api “org.bytedeco:javacv-platform:$javacvVersion”

```
    implementation (group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta6') {
        exclude group: 'org.bytedeco', module: 'opencv-platform'
        exclude group: 'org.bytedeco', module: 'leptonica-platform'
        exclude group: 'org.bytedeco', module: 'hdf5-platform'
        exclude group: 'com.google.guava', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'com.google.code.findbugs', module: 'jsr305'
    }
    implementation (group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6') {
        exclude group: 'com.google.code.findbugs', module: 'jsr305'
        exclude group: 'com.google.guava', module: 'guava'
    }
    implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6', classifier: "android-arm"
    implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6', classifier: "android-arm64"
    implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6', classifier: "android-x86"
    implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6', classifier: "android-x86_64"
    implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.7-1.5.2'
    implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.7-1.5.2', classifier: "android-arm"
    implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.7-1.5.2', classifier: "android-arm64"
    implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.7-1.5.2', classifier: "android-x86"
    implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.7-1.5.2', classifier: "android-x86_64"
    implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.2-1.5.2'
    implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.2-1.5.2', classifier: "android-arm"
    implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.2-1.5.2', classifier: "android-arm64"
    implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.2-1.5.2', classifier: "android-x86"
    implementation group: 'org.bytedeco', name: 'opencv', version: '4.1.2-1.5.2', classifier: "android-x86_64"
    implementation group: 'org.bytedeco', name: 'leptonica', version: '1.78.0-1.5.2'
    implementation group: 'org.bytedeco', name: 'leptonica', version: '1.78.0-1.5.2', classifier: "android-arm"
    implementation group: 'org.bytedeco', name: 'leptonica', version: '1.78.0-1.5.2', classifier: "android-arm64"
    implementation group: 'org.bytedeco', name: 'leptonica', version: '1.78.0-1.5.2', classifier: "android-x86"
    implementation group: 'org.bytedeco', name: 'leptonica', version: '1.78.0-1.5.2', classifier: "android-x86_64"
    testImplementation 'junit:junit:4.12'
    implementation 'com.spotify.android:auth:1.2.3'
    implementation 'io.github.cdimascio:dotenv-java:3.0.0'
    implementation(group: 'org.nd4j', name: 'guava', version: '1.0.0-beta6') {
        exclude group: 'com.google.code.findbugs', module: 'jsr305'
    }

    implementation(group: 'org.nd4j', name: 'protobuf', version: '1.0.0-beta6') {
        exclude group: 'com.google.guava', module: 'guava'
    }

}

```

The reason for a lot of the excludes is because of previous errors we have ran into but have fixed. Thank you for any help regarding this topic 😄

P.S I have also tried looking into potential solutions on the bytedco github repo and will try to incorporate those but if we can find the solution by using nd4j-minimal it would be awesome!

---

<div class="post-metadata">

**Author:** ![Gmane](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/gmane/32/1316_2.png) [@Gmane](https://community.konduit.ai/u/Gmane)\
**Post date:** [September 10, 2024, 7:29am UTC](https://community.konduit.ai/t/flutter-android-appbundle-issues-with-dl4j/3242/2 "2024-09-10T07:29:50Z")

</div>

Also to expand on the previous solution given by the bytedco repo. The recommended we use the [Gradle JavaCPP](https://github.com/bytedeco/gradle-javacpp?tab=readme-ov-file#the-platform-plugin) and its platform plugins to natively compile the code from said needed dependencies.

But my issue with that aswell is that they gave an example of their dependencies as follows:

```auto
dependencies {
    implementation group: 'org.bytedeco', name: 'javacv', version: "$javacvVersion"
    javacpp group: 'org.bytedeco', name: 'openblas-platform', version: "$openblasVersion-$javacppVersion"
    javacpp group: 'org.bytedeco', name: 'opencv-platform', version: "$opencvVersion-$javacppVersion"
    javacpp group: 'org.bytedeco', name: 'ffmpeg-platform', version: "$ffmpegVersion-$javacppVersion"
    ...
}

```

But I’m unsure if we can use such dependencies on our project.

---

<div class="post-metadata">

**Author:** ![TinTran64](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/tintran64/32/1222_2.png) [@TinTran64](https://community.konduit.ai/u/TinTran64)\
**Post date:** [September 10, 2024, 10:46am UTC](https://community.konduit.ai/t/flutter-android-appbundle-issues-with-dl4j/3242/3 "2024-09-10T10:46:35Z")

</div>

Hi, I’m the one who created the topic you mentioned. I was able to fix the issue with nd4j and android with these dependencies

```auto
implementation ('org.nd4j:nd4j-native:1.0.0-M2.1:android-arm64') {
        exclude group: 'org.nd4j', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'org.bytedeco'
    }

    implementation ('org.nd4j:nd4j-native:1.0.0-M2.1:android-arm') {
        exclude group: 'org.nd4j', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'org.bytedeco'
    }

    implementation ('org.nd4j:nd4j-native:1.0.0-M2.1:android-x86') {
        exclude group: 'org.nd4j', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'org.bytedeco'
    }

    implementation ('org.nd4j:nd4j-native:1.0.0-M2.1:android-x86_64') {
        exclude group: 'org.nd4j', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'org.bytedeco'
    }

    implementation ('org.nd4j:nd4j-native:1.0.0-M2.1') {
        exclude group: 'org.nd4j', module: 'guava'
        exclude group: 'org.nd4j', module: 'protobuf'
        exclude group: 'org.bytedeco'
    }

    implementation 'org.bytedeco:openblas:0.3.23-1.5.9'

```

Then I added openBLAS .so files to our jniLibs folder like in the picture. Hope this helps

 ![Screenshot 2024-09-10 at 17.45.06](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/b/b9ca39341299e92fad913d92ee7fd2ad11015bca.png)
