Skip to content

Commit ebde06e

Browse files
committed
Update android example
1 parent 36b705c commit ebde06e

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

android-examples/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The neural networks shown in this example are the same as are used in the [Moon]
66

77
The build configuration for Android can be found in [app/build.gradle](./app/build.gradle).
88

9-
[Go back](../README.md) to the main repository page to explore other features/functionality of the **Eclipse Deeplearning4J** ecosystem. File an issue [here](https://github.com/eclipse/deeplearning4j-examples/issues) to request new features.
9+
[Go back](../README.md) to the main repository page to explore other features/functionality of the **Eclipse Deeplearning4J** ecosystem. File an issue [here](https://github.com/eclipse/deeplearning4j/issues) to request new features.
1010

1111

1212
```

android-examples/app/build.gradle

+28-8
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ information regarding copyright ownership.
2222
apply plugin: 'com.android.application'
2323

2424
android {
25-
compileSdkVersion 29
26-
buildToolsVersion "29.0.3"
27-
25+
packagingOptions {
26+
exclude 'META-INF/native-image/**/**.json'
27+
exclude 'META-INF/native-image/*.json'
28+
pickFirst 'nd4j-native.properties'
29+
}
2830
defaultConfig {
31+
compileSdkVersion 30
32+
2933
applicationId "com.example.androidDl4jClassifier"
30-
minSdkVersion 29
31-
targetSdkVersion 29
34+
minSdkVersion 30
35+
targetSdkVersion 30
3236
versionCode 1
3337
versionName "1.0"
3438

@@ -47,11 +51,27 @@ android {
4751
}
4852
}
4953

54+
configurations {
55+
javacpp
56+
}
57+
58+
task javacppExtract(type: Copy) {
59+
dependsOn configurations.javacpp
60+
61+
from { configurations.javacpp.collect { zipTree(it) } }
62+
include "lib/**"
63+
into "$buildDir/javacpp/"
64+
android.sourceSets.main.jniLibs.srcDirs += ["$buildDir/javacpp/lib/"]
65+
66+
tasks.getByName('preBuild').dependsOn javacppExtract
67+
}
68+
69+
5070
dependencies {
5171
def dl4jVersion = '1.0.0-M2'
52-
def openblasVersion = '0.3.10-1.5.5'
53-
def opencvVersion = '4.5.1-1.5.5'
54-
def leptonicaVersion = '1.80.0-1.5.5'
72+
def openblasVersion = '0.3.19-1.5.7'
73+
def opencvVersion = '4.5.5-1.5.7'
74+
def leptonicaVersion = '1.82.0-1.5.7'
5575

5676
implementation fileTree(dir: 'libs', include: ['*.jar'])
5777

android-examples/app/src/main/AndroidManifest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ information regarding copyright ownership.
2525

2626
<application
2727
android:allowBackup="true"
28-
android:icon="@mipmap/ic_launcher"
28+
android:icon="@mipmap/ic_launcher"0
2929
android:label="@string/app_name"
3030
android:roundIcon="@mipmap/ic_launcher_round"
3131
android:supportsRtl="true"
32+
android:extractNativeLibs="true"
3233
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
3334
android:fullBackupContent="@xml/backup_descriptor">
34-
<activity android:name="com.example.org.deeplearning4j.examples.androidclassifier.MainActivity">
35+
<activity android:name="org.deeplearning4j.examples.androidclassifier.MainActivity">
3536
<intent-filter>
3637
<action android:name="android.intent.action.MAIN" />
3738

android-examples/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ buildscript {
2929

3030
}
3131
dependencies {
32-
classpath 'com.android.tools.build:gradle:4.0.0'
32+
classpath 'com.android.tools.build:gradle:7.1.2'
3333

3434

3535
// NOTE: Do not place your application dependencies here; they belong
@@ -42,7 +42,7 @@ allprojects {
4242
google()
4343
jcenter()
4444
mavenLocal()
45-
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
45+
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" }
4646
}
4747
}
4848

android-examples/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ information regarding copyright ownership.
2727
# http://www.gradle.org/docs/current/userguide/build_environment.html
2828
# Specifies the JVM arguments used for the daemon process.
2929
# The setting is particularly useful for tweaking memory settings.
30-
org.gradle.jvmargs=-Xmx2g
30+
org.gradle.jvmargs=-Xmx4g
3131
# When configured, Gradle will run in incubating parallel mode.
3232
# This option should only be used with decoupled projects. More details, visit
3333
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

android-examples/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ distributionBase=GRADLE_USER_HOME
2424
distributionPath=wrapper/dists
2525
zipStoreBase=GRADLE_USER_HOME
2626
zipStorePath=wrapper/dists
27-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
27+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

0 commit comments

Comments
 (0)