I am switching the dl4j from 1.0.0-beta3 to 1.0.0-beta4 by changing the Gradle file. However, I got the below build error:
Program type already present: org.opencv.android.BaseLoaderCallback$1.
The 1.0.0-beta3 works well for my application, but the 1.0.0-beta4 seems to have a classpath conflict. So, can you please double-check this issue?
Here is my Gradle file for your reference:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "zac.com.mdlnet"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// handle methods too much issue
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// javaCompileOptions {
// annotationProcessorOptions {
// includeCompileClasspath false
// }
// }
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/INDEX.LIST'
}
}
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// for fast message start like json
// after test, the length is not reduced... so no use here
// implementation 'org.msgpack:msgpack-core:0.8.16'
// for json
implementation 'com.google.code.gson:gson:2.8.5'
// for csv
// implementation 'com.univocity.articles.csvcomparison.parser'
// implementation 'de.siegmar:fastcsv:1.0.3'
// for getDevice real bluetooth mac address
// implementation 'net.vidageek:mirror:1.6.1'
// for dl4j training beta3
// implementation(group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta3') {
// exclude group: 'org.bytedeco.javacpp-presets', module: 'opencv-platform'
// exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica-platform'
// exclude group: 'org.bytedeco.javacpp-presets', module: 'hdf5-platform'
// exclude group: 'org.nd4j', module: 'nd4j-base64'
// }
// implementation (group: 'org.deeplearning4j', name: 'rl4j-core', version: '1.0.0-beta3') {
// exclude group: 'org.bytedeco.javacpp-presets', module: 'opencv-platform'
// exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica-platform'
// exclude group: 'org.bytedeco.javacpp-presets', module: 'hdf5-platform'
// exclude group: 'org.nd4j', module: 'nd4j-base64'
// }
//
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta3'
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta3', classifier: "android-arm"
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta3', classifier: "android-arm64"
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta3', classifier: "android-x86"
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta3', classifier: "android-x86_64"
// for dl4j training beta4
implementation(group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta4') {
exclude group: 'org.bytedeco.javacpp-presets', module: 'opencv-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'hdf5-platform'
exclude group: 'org.nd4j', module: 'nd4j-base64'
}
implementation (group: 'org.deeplearning4j', name: 'rl4j-core', version: '1.0.0-beta4') {
exclude group: 'org.bytedeco.javacpp-presets', module: 'opencv-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'hdf5-platform'
exclude group: 'org.nd4j', module: 'nd4j-base64'
}
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta4'
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta4', classifier: "android-arm"
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta4', classifier: "android-arm64"
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta4', classifier: "android-x86"
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta4', classifier: "android-x86_64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.3-1.4.3'
implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.3-1.4.3', classifier: "android-arm"
implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.3-1.4.3', classifier: "android-arm64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.3-1.4.3', classifier: "android-x86"
implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.3-1.4.3', classifier: "android-x86_64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: "android-arm"
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: "android-arm64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: "android-x86"
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: "android-x86_64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.3'
implementation group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.3', classifier: "android-arm"
implementation group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.3', classifier: "android-arm64"
implementation group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.3', classifier: "android-x86"
implementation group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.3', classifier: "android-x86_64"
}
We need to update the dependencies like shown in the examples here:
https://github.com/deeplearning4j/dl4j-examples/blob/master/android/DL4JImageRecognitionDemo/app/build.gradle
Thanks for that @saudet. So, the example code works well, but I think you should update the documentation: https://deeplearning4j.org/docs/latest/deeplearning4j-android. It doesn't show the updated dependencies. Anyways, thanks again.
We need to update the dependencies like shown in the examples here:
https://github.com/deeplearning4j/dl4j-examples/blob/master/android/DL4JImageRecognitionDemo/app/build.gradle
Broken link :(
Program type already present: org.opencv.android.BaseLoaderCallback$5