<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.opencv"
- android:versionCode="@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@0"
- android:versionName="@OPENCV_VERSION@">
+ package="org.opencv" >
</manifest>
apply plugin: 'com.android.library'
+def openCVersionName = "@OPENCV_VERSION@"
+def openCVersionCode = ((@OPENCV_VERSION_MAJOR@ * 100 + @OPENCV_VERSION_MINOR@) * 100 + @OPENCV_VERSION_PATCH@) * 10 + 0
+
android {
compileSdkVersion @ANDROID_COMPILE_SDK_VERSION@
- //buildToolsVersion "x.y.z" // not needed since com.android.tools.build:gradle:3.0.0
defaultConfig {
minSdkVersion @ANDROID_MIN_SDK_VERSION@
targetSdkVersion @ANDROID_TARGET_SDK_VERSION@
+ versionCode openCVersionCode
+ versionName openCVersionName
+
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=@ANDROID_STL@"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.opencv"
- android:versionCode="@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@0"
- android:versionName="@OPENCV_VERSION@">
+ package="org.opencv">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
</manifest>
apply plugin: 'com.android.library'
-println "OpenCV: " + project.buildscript.sourceFile
+def openCVersionName = "@OPENCV_VERSION@"
+def openCVersionCode = @OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@0
+
+println "OpenCV: " +openCVersionName + " " + project.buildscript.sourceFile
android {
compileSdkVersion @ANDROID_COMPILE_SDK_VERSION@
- //buildToolsVersion "x.y.z" // not needed since com.android.tools.build:gradle:3.0.0
defaultConfig {
minSdkVersion @ANDROID_MIN_SDK_VERSION@
targetSdkVersion @ANDROID_TARGET_SDK_VERSION@
+ versionCode openCVersionCode
+ versionName openCVersionName
+
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=@ANDROID_STL@"
import android.content.Context;
+import org.opencv.BuildConfig;
+
/**
* Helper class provides common initialization methods for OpenCV library.
*/
/**
* Current OpenCV Library version
*/
- public static final String OPENCV_VERSION = "@OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@.@OPENCV_VERSION_PATCH@";
+ public static final String OPENCV_VERSION = BuildConfig.VERSION_NAME;
/**