Skip to content

Commit

Permalink
Update Eigen to 3.3.5, Gradle to 4.6, compile for Android SDK 28 and …
Browse files Browse the repository at this point in the history
…extended patch for OpenCV in order to remove the minSdkVersion and targetSdkVersion from the manifest, as these are defined in the build.gradle file
  • Loading branch information
Lauszus committed Dec 17, 2018
1 parent 42b89d2 commit 79020d2
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 32 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ android:
- platform-tools

# The BuildTools version used by your project
- build-tools-27.0.3
- build-tools-28.0.3

# The SDK version used to compile your project
- android-27
- android-28

# Additional components
- extra-android-m2repository

before_install:
# Accept the licenses needed for OpenCV and this project
- yes | sdkmanager "platforms;android-27" "platforms;android-28"

before_script:
# Download Android NDK, OpenCV Android SDK and Eigen 3
- if test ! -e $HOME/zip-cache/android-ndk.zip ; then wget https://dl.google.com/android/repository/android-ndk-r18-linux-x86_64.zip -O $HOME/zip-cache/android-ndk.zip ; fi
- if test ! -e $HOME/zip-cache/opencv-sdk.zip ; then wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip -O $HOME/zip-cache/opencv-sdk.zip ; fi
- if test ! -e $HOME/zip-cache/eigen3.zip ; then wget https://bitbucket.org/eigen/eigen/get/3.3.4.zip -O $HOME/zip-cache/eigen3.zip ; fi
- if test ! -e $HOME/zip-cache/eigen3.zip ; then wget https://bitbucket.org/eigen/eigen/get/3.3.5.zip -O $HOME/zip-cache/eigen3.zip ; fi

# Unzip the zip files into their directories
- unzip -qq -n $HOME/zip-cache/android-ndk.zip -d $HOME/android-ndk
Expand All @@ -56,8 +60,8 @@ before_script:
- export OPENCV_ANDROID_SDK=$HOME/opencv-sdk/OpenCV-android-sdk
- export EIGEN3_DIR=$(dirname $(find $HOME/eigen3 -type f -name 'signature_of_eigen3_matrix_library' -print -quit))

# Patch OpenCV, so it does not abort on lint errors
- patch $OPENCV_ANDROID_SDK/sdk/build.gradle < opencv.patch
# Apply patch to OpenCV
- patch -d$OPENCV_ANDROID_SDK/../ -p0 < opencv.patch

script:
- ./gradlew --no-daemon build
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ git submodule update --init --recursive

The project is relying on the environmental variables ```OPENCV_ANDROID_SDK``` and ```EIGEN3_DIR``` for [settings.gradle](settings.gradle) and [Android.mk](app/src/main/cpp/Android.mk) to be set to the path of the [OpenCV Android SDK](http://opencv.org/platforms/android) and [Eigen3](https://eigen.tuxfamily.org) libraries.

Please use [OpenCV 3.4.1](https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip) and [Eigen3 3.3.4](https://bitbucket.org/eigen/eigen/get/3.3.4.zip). Both can be installed from the command line like so:
Please use [OpenCV 3.4.1](https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip) and [Eigen3 3.3.5](https://bitbucket.org/eigen/eigen/get/3.3.5.zip). Both can be installed from the command line like so:

```bash
wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip
unzip opencv-3.4.1-android-sdk.zip
wget https://bitbucket.org/eigen/eigen/get/3.3.4.zip -O Eigen3.zip
wget https://bitbucket.org/eigen/eigen/get/3.3.5.zip -O Eigen3.zip
unzip Eigen3.zip
```

Expand Down Expand Up @@ -84,5 +84,3 @@ echo %OPENCV_ANDROID_SDK% %EIGEN3_DIR%
__Please note that ```/path/to/``` should be replaced with the actual path to the Eigen and OpenCV Android SDK directories.__

If you have troubles setting the environmental variables, then you can just hardcode the paths in [settings.gradle](settings.gradle) and [Android.mk](app/src/main/cpp/Android.mk).

For more information send me an email at <lauszus@gmail.com>.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId 'com.lauszus.facerecognitionapp'
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode 5
versionName '1.2.2'
vectorDrawables.useSupportLibrary = true
ndk {
stl 'c++_static'
cFlags '-std=gnu++11 -fexceptions -frtti'
cFlags '-std=gnu++11 -fexceptions -frtti -DANDROID_STL=c++_static'
}
setProperty('archivesBaseName', rootProject.name + '-' + defaultConfig.versionName)
}
Expand Down Expand Up @@ -70,8 +70,8 @@ android {
}

dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation project(':opencv')
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/cpp/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_PLATFORM := android-27
APP_PLATFORM := android-28
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_STL := c++_static
APP_CPPFLAGS := -std=gnu++11 -frtti -fexceptions
APP_CPPFLAGS := -std=gnu++11 -frtti -fexceptions -DANDROID_STL=c++_static

ifeq ($(NDK_DEBUG),0)
APP_CPPFLAGS += -DNDEBUG
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Apr 16 03:03:10 CEST 2018
#Sun Dec 16 21:52:50 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
40 changes: 27 additions & 13 deletions opencv.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
--- build-orig.gradle 2018-04-16 09:10:01.000000000 +0200
+++ build.gradle 2018-04-16 09:11:53.000000000 +0200
@@ -121,6 +121,10 @@
manifest.srcFile 'java/AndroidManifest.xml'
}
}
+
+ lintOptions {
+ abortOnError false
+ }
}

dependencies {
diff -crb OpenCV-android-sdk/sdk/build.gradle OpenCV-android-sdk-patch/sdk/build.gradle
*** OpenCV-android-sdk/sdk/build.gradle Sun Dec 16 22:44:27 2018
--- OpenCV-android-sdk-patch/sdk/build.gradle Sun Dec 16 22:34:33 2018
***************
*** 121,126 ****
--- 121,130 ----
manifest.srcFile 'java/AndroidManifest.xml'
}
}
+
+ lintOptions {
+ abortOnError false
+ }
}

dependencies {
diff -crb OpenCV-android-sdk/sdk/java/AndroidManifest.xml OpenCV-android-sdk-patch/sdk/java/AndroidManifest.xml
*** OpenCV-android-sdk/sdk/java/AndroidManifest.xml Fri Feb 23 12:24:24 2018
--- OpenCV-android-sdk-patch/sdk/java/AndroidManifest.xml Sun Dec 16 22:28:32 2018
***************
*** 4,8 ****
android:versionCode="3410"
android:versionName="3.4.1">

- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
</manifest>
--- 4,7 ----

0 comments on commit 79020d2

Please sign in to comment.