Skip to content

Commit d8293ec

Browse files
committed
Upgrade to AndroidX, Gradle 6.1.1, Kotlin 1.3.72, NDK r21d, Android Build Tool 29.0.3 and Gradle Plugin 4.0.1.
1 parent 4d5c5db commit d8293ec

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ This sample Android application displays a live camera feed with an OpenCV *adap
1111
| Tool | Version |
1212
| --- | --- |
1313
| [OpenCV](https://opencv.org) | 4.4.0
14-
| [Android Studio](https://developer.android.com/studio) | 3.6.2
15-
| [Android Build Tool](https://developer.android.com/about) | 29.0.1
16-
| [Android NDK](https://developer.android.com/ndk/guides) | Revision r20
17-
| [Kotlin](https://kotlinlang.org/docs/reference/) | 1.3.50
18-
| [Gradle](https://gradle.org) | 5.4.1
19-
| Mac OS | 10.15.4
14+
| [Android Studio](https://developer.android.com/studio) | 4.0.1
15+
| [Android Build Tool](https://developer.android.com/about) | 29.0.3
16+
| [Android NDK](https://developer.android.com/ndk/guides) | r21d
17+
| [Kotlin](https://kotlinlang.org/docs/reference/) | 1.3.72
18+
| [Gradle](https://gradle.org) | 6.1.1
19+
| Mac OS | 10.15.6
2020

2121
## How to use this repository
2222

app/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ apply plugin: 'kotlin-android'
55
apply plugin: 'kotlin-android-extensions'
66

77
android {
8-
compileSdkVersion 28
9-
buildToolsVersion "29.0.1"
8+
compileSdkVersion 30
9+
buildToolsVersion "29.0.3"
1010
defaultConfig {
1111
applicationId "com.example.nativeopencvandroidtemplate"
1212
minSdkVersion 28
13-
targetSdkVersion 28
13+
targetSdkVersion 30
1414
versionCode 1
1515
versionName "1.0"
16-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1717
externalNativeBuild {
1818
cmake {
1919
cppFlags "-frtti -fexceptions"
@@ -34,15 +34,16 @@ android {
3434
version "3.10.2"
3535
}
3636
}
37+
ndkVersion '21.3.6528147'
3738
}
3839

3940
dependencies {
4041
implementation fileTree(dir: 'libs', include: ['*.jar'])
4142
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
42-
implementation 'com.android.support:appcompat-v7:28.0.0'
43-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
43+
implementation 'androidx.appcompat:appcompat:1.2.0'
44+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
4445
testImplementation 'junit:junit:4.12'
45-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
46-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
47+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
4748
implementation project(path: ':opencv')
4849
}

app/src/androidTest/java/com/example/nativeopencvandroidtemplate/ExampleInstrumentedTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.example.nativeopencvandroidtemplate
22

3-
import android.support.test.InstrumentationRegistry
4-
import android.support.test.runner.AndroidJUnit4
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
55

66
import org.junit.Test
77
import org.junit.runner.RunWith
@@ -18,7 +18,7 @@ class ExampleInstrumentedTest {
1818
@Test
1919
fun useAppContext() {
2020
// Context of the app under test.
21-
val appContext = InstrumentationRegistry.getTargetContext()
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2222
assertEquals("com.example.nativeopencvandroidtemplate", appContext.packageName)
2323
}
2424
}

app/src/main/java/com/example/nativeopencvandroidtemplate/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//import android.app.Activity;
55
//import android.content.pm.PackageManager;
66
//import android.os.Bundle;
7-
//import android.support.v4.app.ActivityCompat;
7+
//import androidx.core.app.ActivityCompat;
88
//import android.util.Log;
99
//import android.view.SurfaceView;
1010
//import android.view.WindowManager;

app/src/main/kotlin/com/example/nativeopencvandroidtemplate/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.Manifest
44
import android.app.Activity
55
import android.content.pm.PackageManager
66
import android.os.Bundle
7-
import android.support.v4.app.ActivityCompat
7+
import androidx.core.app.ActivityCompat
88
import android.util.Log
99
import android.view.SurfaceView
1010
import android.view.WindowManager

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.50'
4+
ext.kotlin_version = '1.3.72'
55
repositories {
66
google()
77
jcenter()
88

99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.5.1'
11+
classpath 'com.android.tools.build:gradle:4.0.1'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ org.gradle.jvmargs=-Xmx1536m
1313
# org.gradle.parallel=true
1414
# Kotlin code style for this project: "official" or "obsolete":
1515
kotlin.code.style=official
16+
android.useAndroidX=true
17+
android.enableJetifier=true
1618

17-
opencvsdk=/Users/Example/Downloads/OpenCV-android-sdk
19+
opencvsdk=/Users/Example/Downloads/OpenCV-android-sdk
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Sep 09 21:23:30 CEST 2019
1+
#Mon Aug 17 14:18:33 CEST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

0 commit comments

Comments
 (0)