Migration to Android Studio 3.0 (#34)

+ Java 1.8
+ API 26, build tools 26.0.2
+ support libraries 26.1.0
+ enabling proguard
This commit is contained in:
Aleksander Nowakowski
2017-11-02 11:08:31 +01:00
parent 5f43630340
commit e99197d74a
33 changed files with 210 additions and 196 deletions

View File

@@ -1,57 +1,61 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18
targetSdkVersion 25
targetSdkVersion 26
versionCode 60
versionName "2.4.0"
resConfigs "en"
}
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
fastBuild {
// Switching the flavor to fastBuild accelerates te build speed (works only with Android 7+ devices)
minSdkVersion 21
versionName "Instant Run"
}
releaseBuild {
minSdkVersion 18
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
compile 'no.nordicsemi.android:log:2.1.0'
compile('org.simpleframework:simple-xml:2.7.1') {
implementation project(':common')
implementation fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(path: ':wear')
// nRF Toolbox is using Play Service 10.2.0 in order to make the app working in China:
// https://developer.android.com/training/wearables/apps/creating-app-china.html
//noinspection GradleDependency
implementation 'com.google.android.gms:play-services-wearable:10.2.0'
//noinspection GradleDependency
implementation 'com.android.support:appcompat-v7:26.1.0'
//noinspection GradleDependency
implementation 'com.android.support:design:26.1.0'
implementation 'no.nordicsemi.android:log:2.1.1'
implementation 'no.nordicsemi.android.support.v18:scanner:1.0.0'
// The DFU Library is imported automatically from jcenter:
implementation 'no.nordicsemi.android:dfu:1.5.1'
// if you desire to build the DFU Library, clone the https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder,
// add it as a module into the project structure and uncomment the following line (and also the according lines in the settings.gradle):
// implementation project(':dfu')
implementation('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
exclude group: 'xpp3', module: 'xpp3'
}
compile files('libs/achartengine-1.1.0.jar')
compile project(':common')
wearApp project(path: ':wear', configuration: 'wear1Release')
// nRF Toolbox is using Play Service 7.8.87 in order to make the app working in China:
// https://developer.android.com/training/wearables/apps/creating-app-china.html#ChinaSDK
compile 'com.google.android.gms:play-services-wearable:7.8.87'
// The DFU Library is imported automatically from jcenter.
compile 'no.nordicsemi.android:dfu:1.3.0'
// If you want to make some changes in the DFU Library, clone the https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder,
// add it as a module in Project Structure and uncomment the following line:
// compile project(':dfu')
// Also uncomment selected lines in settings.gradle
}
}

105
app/proguard-rules.pro vendored
View File

@@ -1,17 +1,92 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\alno\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
-libraryjars ../app/libs
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dontshrink
-verbose
# Add any project specific keep options here:
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keepattributes *Annotation*
-keepattributes Signature
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older platform version.
-dontwarn android.support.**
# android-support-design
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep,includedescriptorclasses class android.support.transition.** { *; }
-keep public class android.support.design.R$* { *; }
# android-support-v4
-dontwarn android.support.v4.**
-dontnote android.support.v4.**
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v4.app.** { *; }
-keep class android.support.v4.** { *; }
# android-support-v7
-dontwarn android.support.v7.**
-dontnote android.support.v7.**
-keep interface android.support.v7.internal.** { *; }
-keep class android.support.v7.internal.** { *; }
-keep class android.support.v7.** { *; }
-keep class com.google.android.gms.**
-dontwarn com.google.android.gms.**
# Java
-keep class java.** { *; }
-dontnote java.**
-dontwarn java.**
-keep class javax.** { *; }
-dontnote javax.**
-dontwarn javax.**
-keep class sun.misc.Unsafe { *; }
-dontnote sun.misc.Unsafe
-keep class javax.xml.stream.XMLOutputFactory { *; }
# (the rt.jar has them)
-dontwarn com.bea.xml.stream.XMLWriterBase
-dontwarn javax.xml.stream.events.**
# Simple XML
-keep public class org.simpleframework.** { *; }
-keep class org.simpleframework.xml.** { *; }
-keep class org.simpleframework.xml.core.** { *; }
-keep class org.simpleframework.xml.util.** { *; }
# Chart Engine
-keep class org.achartengine.** { *; }
-dontnote org.achartengine.**
# HTTP (might require legacyLibraries) ?
-dontnote org.apache.http.params.**
-dontnote org.apache.http.conn.scheme.**
-dontnote org.apache.http.conn.**
-dontnote android.net.http.**

View File

@@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -17,11 +18,21 @@ allprojects {
maven {
url "https://maven.google.com"
}
maven {
// nRF Toolbox is using Play Service 7.8.87 in order to make the app working in China:
// https://developer.android.com/training/wearables/apps/creating-app-china.html#ChinaSDK
url "${rootProject.projectDir}/google-play-services-7-8-87"
}
jcenter()
google()
}
}
// clean
task clean(type: Delete) {
delete rootProject.buildDir
delete project.buildDir
// when the task has finished
doLast {
// create a new APK output directory
mkdir("${project.buildDir}/outputs/apk")
}
}

View File

@@ -23,24 +23,35 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
resConfigs "en"
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleDependency
implementation 'com.android.support:support-core-utils:26.1.0'
}

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-base</artifactId>
<version>7.8.87</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
</dependencies>
</project>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-base</artifactId>
<versioning>
<release>7.8.87</release>
<versions>
<version>7.8.87</version>
</versions>
<lastUpdated>20160122142403</lastUpdated>
</versioning>
</metadata>

View File

@@ -1 +0,0 @@
b9f5ee764168532d755f67199a04e464

View File

@@ -1 +0,0 @@
a6b3c7a460e1cf0a42c1f752f0bbbf5053d2b326

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-wearable</artifactId>
<version>7.8.87</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-base</artifactId>
<version>7.8.87</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
</dependencies>
</project>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-wearable</artifactId>
<versioning>
<release>7.8.87</release>
<versions>
<version>7.8.87</version>
</versions>
<lastUpdated>20160122142522</lastUpdated>
</versioning>
</metadata>

View File

@@ -1 +0,0 @@
778c562ea8f51095b26d0e0d2ce20d79a320505d

View File

@@ -1 +0,0 @@
243d1a6ba16f2a4c1ccd19e3526e393584647e32

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>7.8.87</version>
<packaging>aar</packaging>
 <dependencies>
   <dependency>
     <groupId>com.android.support</groupId>
     <artifactId>support-v4</artifactId>
     <version>22.2.0</version>
     <scope>compile</scope>
     <type>aar</type>
   </dependency>
 </dependencies>
</project>

View File

@@ -1 +0,0 @@
6d34bc667647052417927ef361176a1288f629ab

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<versioning>
<release>7.8.87</release>
<versions>
<version>7.8.87</version>
</versions>
<lastUpdated>20160122142802</lastUpdated>
</versioning>
</metadata>

View File

@@ -1 +0,0 @@
eb2e8c0689b46bfbd05bff7431559569

View File

@@ -1 +0,0 @@
9ca5b558fcb911cf330b71ab7b0ea83843fc9a6c

View File

@@ -1,6 +1,6 @@
#Thu Mar 09 12:14:38 CET 2017
#Mon Oct 23 10:50:01 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

@@ -1,41 +1,62 @@
// module :wear build.gradle for Wear 1.0 and 2.0 watches.
// https://developer.android.com/training/wearables/apps/packaging.html
apply plugin: 'com.android.application'
android {
publishNonDefault true
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 20
targetSdkVersion 25
versionCode 202225700 // target: 25, version: 2.2.2, build: 57, multi-APK: 01
versionName "2.2.2"
minSdkVersion 23
targetSdkVersion 26
resConfigs "en"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
wear1 {
// Use the defaultConfig value
}
wear2 {
minSdkVersion 25
versionCode 252225701 // target: 25, version: 2.2.2, build: 57, multi-APK: 01
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// exclude these from the build:
configurations.all() { configuration -> exclude group: "org.apache.httpcomponents", module: "httpclient" }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:2.0.3'
provided 'com.google.android.wearable:wearable:2.0.3'
// nRF Toolbox is using Play Service 7.8.87 in order to make the app working in China:
implementation project(':common')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'no.nordicsemi.android.support.v18:scanner:1.0.0'
implementation 'com.google.android.support:wearable:2.1.0'
compileOnly 'com.google.android.wearable:wearable:2.1.0'
// uncomment to enable the Wear UI Library
// https://developer.android.com/training/wearables/ui/wear-ui-library.html
// implementation 'com.android.support:wear:26.0.2'
// nRF Toolbox is using Play Service 10.2.0 in order to make the app working in China:
// https://developer.android.com/training/wearables/apps/creating-app-china.html#ChinaSDK
compile 'com.google.android.gms:play-services-wearable:7.8.87'
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
compile project(':common')
//noinspection GradleDependency
implementation 'com.google.android.gms:play-services-wearable:10.2.0'
}
// temporary workaround for support library version mismatch
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.1.0'
}
}
}
}