Move from minSDK 9 to min 14 (#245)

- Upgrade to latest gradle build tools (3.0.0)
 - Remove unused code, and debug cradle code
 - Compile against latest Android (26)
 - Using latest build tools (26.0.0)
 - Use latest support library (26.1.0)
 - Add google maven repo
 - Use latest gradle version (4.1)
 - Target latest version of Android in samples (26)
 - Remove dependency on libs folder - unnecessary
 - Remove release flavours for samples (never used)

The example and sample have to depend on the compile project dependency for now, until a new release is done that includes the manifest merging.

Signed-off-by: Blundell <paul@novoda.com>
This commit is contained in:
Paul Blundell 2017-10-04 16:22:10 +01:00 committed by James Sutton
parent c862ee086e
commit 2cfc0e6c04
11 changed files with 31 additions and 159 deletions

View File

@ -4,9 +4,10 @@ buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.0.0-beta5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@ -14,8 +15,9 @@ buildscript {
ext{
compileSdkVersion = 24
buildToolsVersion = '23.0.3'
compileSdkVersion = 26
buildToolsVersion = '26.0.0'
supportLibVersion = '26.1.0'
group = 'org.eclipse.paho'
@ -30,7 +32,6 @@ ext{
mavenUrl = "https://repo.eclipse.org/content/repositories/paho-releases/"
supportLibVersion = '24.2.1'
}
@ -51,9 +52,6 @@ def androidHomeIsDefined = androidHome?.trim()
def sdkDir = androidHomeIsDefined ? androidHome : getSdkDirFromLocalProperties()
println "SDK dir: $sdkDir"
allprojects {
repositories {
@ -61,6 +59,7 @@ allprojects {
maven {
url "file://$sdkDir/extras/android/m2repository/"
}
google()
}
version = rootProject.ext.serviceVersion

View File

@ -1,6 +1,6 @@
#Tue Jan 24 11:18:55 GMT 2017
#Wed Oct 04 11:50:11 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

@ -7,22 +7,13 @@ android {
defaultConfig {
applicationId rootProject.ext.sampleArchivesBaseName
minSdkVersion 16
targetSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
dexOptions {
preDexLibraries = false
}
}
repositories {
@ -32,23 +23,15 @@ repositories {
dependencies {
//compile fileTree(dir: '../org.eclipse.paho.android/service/libs', excludes: ["org.eclipse.paho.client.mqttv3-${rootProject.ext.clientVersion}.jar"], include: '')
compile project(':org.eclipse.paho.android.service')
// compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
// compile "org.eclipse.paho:org.eclipse.paho.android.service:${rootProject.ext.clientVersion}"
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
compile (project(':org.eclipse.paho.android.service')){
//exclude module: "org.eclipse.paho.client.mqttv3"
transitive=true
}
}
task publishAPK(type: Copy) {
from file("${project.buildDir}/outputs/apk/" + rootProject.ext.sampleArchivesBaseName + "-debug.apk");
into '/shared/technology/paho/Android/' + rootProject.ext.sampleVersion + '/debug/';
}
configurations.compile.exclude module: 'org.eclipse.paho.client.mqttv3'
task debug << {
configurations.compile.each { println it}
}

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/james/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
# Add any project specific keep options here:
# 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 *;
#}

View File

@ -5,15 +5,9 @@
<!-- Permissions the Application Requires -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
@ -33,9 +27,6 @@
</activity>
<!-- Mqtt Service -->
<service android:name="org.eclipse.paho.android.service.MqttService">
</service>
</application>
</manifest>

View File

@ -6,21 +6,11 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion 24
testApplicationId "org.eclipse.paho.android.service.test"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
lintOptions {
abortOnError false
@ -31,14 +21,9 @@ repositories {
maven { url rootProject.ext.mavenUrl }
}
configurations {
//androidTestCompile.exclude module: 'org.eclipse.paho.client.mqttv3'
}
dependencies {
compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile fileTree(include: ['*.jar'], dir: 'libs')
}
android.libraryVariants.all { variant ->
@ -62,14 +47,6 @@ task("generateSourcesJar", type: Jar) {
classifier = 'sources'
}
// Copy the Paho Java client into the libs directory to bundle it with the AAR
task("copyLibs", type: Copy) {
println "Copying MQTT Jar into libs directory"
from configurations.compile
into 'libs'
include 'org.eclipse.paho*'
}
// Renames the Release AAR file to a maven convention
task("renameReleaseAAR", type: Copy) {
from("$buildDir/outputs/aar")
@ -118,17 +95,6 @@ publishing {
}
task debug << {
configurations.compile.each { println it}
}
// Required to bundle Java library Jar in AAR
clean.doLast{
copyLibs.execute()
}
assemble.doLast {
renameReleaseAAR.execute()
}
clean.doFirst {
delete 'libs'
}

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/james/Android/Sdk/tools/proguard/proguard-org.eclipse.paho.android.service.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
# Add any project specific keep options here:
# 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 *;
#}

View File

@ -1,7 +1,14 @@
<manifest
package="org.eclipse.paho.android.service">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eclipse.paho.android.service">
<application>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<!-- Mqtt Service -->
<service android:name="org.eclipse.paho.android.service.MqttService" />
</application>
</manifest>

View File

@ -7,19 +7,10 @@ android {
defaultConfig {
applicationId "paho.mqtt.java.example"
minSdkVersion 16
targetSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
lintOptions {
abortOnError false
}
@ -31,19 +22,12 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', excludes: ["org.eclipse.paho.client.mqttv3-${rootProject.ext.clientVersion}.jar"], include: '*.jar')
testCompile 'junit:junit:4.12'
compile project(':org.eclipse.paho.android.service')
// compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
// compile "org.eclipse.paho:org.eclipse.paho.android.service:${rootProject.ext.clientVersion}"
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile "org.eclipse.paho:org.eclipse.paho.client.mqttv3:${rootProject.ext.clientVersion}"
compile (project(':org.eclipse.paho.android.service')){
//exclude module: "org.eclipse.paho.client.mqttv3"
transitive=true
}
}
configurations.compile.exclude module: 'org.eclipse.paho.client.mqttv3'
task debug << {
configurations.compile.each { println it}
testCompile 'junit:junit:4.12'
}

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/james/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
# Add any project specific keep options here:
# 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 *;
#}

View File

@ -5,14 +5,9 @@
<!-- Permissions the Application Requires -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
@ -30,9 +25,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Mqtt Service -->
<service android:name="org.eclipse.paho.android.service.MqttService">
</service>
</application>
</manifest>