Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

allprojects {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public class Constants {
public static final String OPENCV_VERSION_ANDROID_SDK_EXTRACTED_DIRECTORY_NAME = "opencv-%s-android-sdk";
public static final String OPENCV_AAR_NAME_PREFIX = "opencv";
public static final String EXTRACTED_OPENCV_ROOT_DIRECTORY_NAME = "OpenCV-android-sdk";
public static final String GRADLE_VERSION = null;

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import org.gradle.tooling.BuildLauncher;
import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;
import org.gradle.util.GradleVersion;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Optional;
import java.util.ResourceBundle;

/**
Expand Down Expand Up @@ -182,10 +184,14 @@ private void performBuildAndroidOpenCVAars() {
ExceptionUtils.getCauses(e, messages.getString("caused_by")), e);
}

String gradleVersion = Optional.ofNullable(Constants.GRADLE_VERSION)
.orElse(GradleVersion.current().getVersion());
logger.info("Use GradleVersion: " + gradleVersion);

// Build AAR binaries
try (ProjectConnection buildCacheProjectConnection = GradleConnector.newConnector()
.forProjectDirectory(androidOpenCVBuildCacheDir)
.useGradleVersion("4.1")
.useGradleVersion(gradleVersion)
.connect()) {

BuildLauncher launcher = buildCacheProjectConnection.newBuild()
Expand Down
2 changes: 2 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
google()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
mavenLocal()
}
dependencies {
//noinspection GradleDependency
Expand All @@ -18,6 +19,7 @@ repositories {
jcenter()
google()
mavenCentral()
mavenLocal()
}

apply plugin: 'com.android.application'
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/java/com/ahasbini/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void onResume() {
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.i(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initiation");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_4_0, this, mLoaderCallback);
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION, this, mLoaderCallback);
} else {
Log.i(TAG, "OpenCV library found inside package. Using it");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
Expand Down