Skip to content

Commit 3e9c4e3

Browse files
Merge pull request #9 from ened/android-cleanup
Android updates (gradle, build)
2 parents 743131d + 96e9026 commit 3e9c4e3

File tree

9 files changed

+62
-37
lines changed

9 files changed

+62
-37
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [0.0.5] - August 21, 2018
2+
* Update Android SDK reference
3+
14
## [0.0.4] - August 21, 2018
25
* Adjust pubspec.yml to match Dart 2.0 SDK version
36

android/build.gradle

+31-12
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
125
group 'flutter.plugins.screen.screen'
226
version '1.0-SNAPSHOT'
327

428
buildscript {
529
repositories {
30+
google()
631
jcenter()
7-
maven {
8-
url "https://maven.google.com"
9-
}
1032
}
1133

1234
dependencies {
13-
classpath 'com.android.tools.build:gradle:2.3.3'
35+
classpath 'com.android.tools.build:gradle:3.3.1'
1436
}
1537
}
1638

1739
rootProject.allprojects {
1840
repositories {
41+
google()
1942
jcenter()
20-
maven {
21-
url "https://maven.google.com"
22-
}
2343
}
2444
}
2545

2646
apply plugin: 'com.android.library'
2747

2848
android {
29-
compileSdkVersion 25
30-
buildToolsVersion '25.0.3'
49+
compileSdkVersion 28
3150

3251
defaultConfig {
3352
minSdkVersion 16
34-
targetSdkVersion 25
35-
versionCode 1
36-
versionName "1.0"
53+
targetSdkVersion 28
54+
versionCode flutterVersionCode.toInteger()
55+
versionName flutterVersionName
3756
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3857
}
3958
lintOptions {

android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ 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-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

example/android/app/build.gradle

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
def localProperties = new Properties()
22
def localPropertiesFile = rootProject.file('local.properties')
33
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withInputStream { stream ->
5-
localProperties.load(stream)
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
66
}
77
}
88

@@ -11,24 +11,32 @@ if (flutterRoot == null) {
1111
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
1212
}
1313

14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
1424
apply plugin: 'com.android.application'
1525
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
1626

1727
android {
18-
compileSdkVersion 25
19-
buildToolsVersion '25.0.3'
28+
compileSdkVersion 28
2029

2130
lintOptions {
2231
disable 'InvalidPackage'
2332
}
2433

2534
defaultConfig {
26-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
2735
applicationId "flutter.plugins.screen.screenexample"
2836
minSdkVersion 16
29-
targetSdkVersion 25
30-
versionCode 1
31-
versionName "1.0"
37+
targetSdkVersion 28
38+
versionCode flutterVersionCode.toInteger()
39+
versionName flutterVersionName
3240
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3341
}
3442

@@ -43,10 +51,4 @@ android {
4351

4452
flutter {
4553
source '../..'
46-
}
47-
48-
dependencies {
49-
androidTestCompile 'com.android.support:support-annotations:25.4.0'
50-
androidTestCompile 'com.android.support.test:runner:0.5'
51-
androidTestCompile 'com.android.support.test:rules:0.5'
52-
}
54+
}

example/android/build.gradle

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
buildscript {
22
repositories {
3+
google()
34
jcenter()
4-
maven {
5-
url "https://maven.google.com"
6-
}
75
}
86

97
dependencies {
10-
classpath 'com.android.tools.build:gradle:2.3.3'
8+
classpath 'com.android.tools.build:gradle:3.3.1'
119
}
1210
}
1311

12+
1413
allprojects {
1514
repositories {
15+
google()
1616
jcenter()
17-
maven {
18-
url "https://maven.google.com"
19-
}
2017
}
2118
}
2219

2320
rootProject.buildDir = '../build'
2421
subprojects {
2522
project.buildDir = "${rootProject.buildDir}/${project.name}"
23+
}
24+
subprojects {
2625
project.evaluationDependsOn(':app')
2726
}
2827

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ 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-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

example/ios/Flutter/Debug.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Flutter/Release.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: screen
22
description: A Flutter plugin to manage the device's screen on Android and iOS.
3-
version: 0.0.4
3+
version: 0.0.5
44
author: Clovis Nicolas <clovisnicolas0@gmail.com>
55
homepage: https://github.com/clovisnicolas/flutter_screen
66

0 commit comments

Comments
 (0)