Flutter Android AppBundle issues with DL4J

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 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 :smile:

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!

Also to expand on the previous solution given by the bytedco repo. The recommended we use the Gradle JavaCPP 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:

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.

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

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