Update /examples/ to new gradle based build flow (#8173) * Update hello_world to new gradle based build flow * Update flutter_gallery to gradle based build * Align hello_services with new gradle based build * Update platform_services to new gradle based build * Upgrade stock to gradle based build
diff --git a/examples/flutter_gallery/android/.gitignore b/examples/flutter_gallery/android/.gitignore new file mode 100644 index 0000000..5c4ef82 --- /dev/null +++ b/examples/flutter_gallery/android/.gitignore
@@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat
diff --git a/examples/flutter_gallery/android/app/build.gradle b/examples/flutter_gallery/android/app/build.gradle new file mode 100644 index 0000000..90c2899 --- /dev/null +++ b/examples/flutter_gallery/android/app/build.gradle
@@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +}
diff --git a/examples/flutter_gallery/android/AndroidManifest.xml b/examples/flutter_gallery/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/flutter_gallery/android/AndroidManifest.xml rename to examples/flutter_gallery/android/app/src/main/AndroidManifest.xml
diff --git a/examples/flutter_gallery/android/res/mipmap-hdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-hdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ
diff --git a/examples/flutter_gallery/android/res/mipmap-mdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-mdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ
diff --git a/examples/flutter_gallery/android/res/mipmap-xhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ
diff --git a/examples/flutter_gallery/android/res/mipmap-xxhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xxhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ
diff --git a/examples/flutter_gallery/android/res/mipmap-xxxhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xxxhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ
diff --git a/examples/flutter_gallery/android/build.gradle b/examples/flutter_gallery/android/build.gradle new file mode 100644 index 0000000..d82a154 --- /dev/null +++ b/examples/flutter_gallery/android/build.gradle
@@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +}
diff --git a/examples/flutter_gallery/android/gradle.properties b/examples/flutter_gallery/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/examples/flutter_gallery/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/examples/flutter_gallery/android/settings.gradle b/examples/flutter_gallery/android/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/flutter_gallery/android/settings.gradle
@@ -0,0 +1 @@ +include ':app'
diff --git a/examples/hello_services/android/app/build.gradle b/examples/hello_services/android/app/build.gradle index a8a6695..90c2899 100644 --- a/examples/hello_services/android/app/build.gradle +++ b/examples/hello_services/android/app/build.gradle
@@ -16,7 +16,7 @@ android { compileSdkVersion 25 - buildToolsVersion '24.0.2' + buildToolsVersion '24.0.1' lintOptions { disable 'InvalidPackage'
diff --git a/examples/hello_world/android/.gitignore b/examples/hello_world/android/.gitignore new file mode 100644 index 0000000..5c4ef82 --- /dev/null +++ b/examples/hello_world/android/.gitignore
@@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat
diff --git a/examples/hello_world/android/app/build.gradle b/examples/hello_world/android/app/build.gradle new file mode 100644 index 0000000..90c2899 --- /dev/null +++ b/examples/hello_world/android/app/build.gradle
@@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +}
diff --git a/examples/hello_world/android/AndroidManifest.xml b/examples/hello_world/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/hello_world/android/AndroidManifest.xml rename to examples/hello_world/android/app/src/main/AndroidManifest.xml
diff --git a/examples/hello_world/android/build.gradle b/examples/hello_world/android/build.gradle new file mode 100644 index 0000000..d82a154 --- /dev/null +++ b/examples/hello_world/android/build.gradle
@@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +}
diff --git a/examples/hello_world/android/gradle.properties b/examples/hello_world/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/examples/hello_world/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/examples/hello_world/android/settings.gradle b/examples/hello_world/android/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/hello_world/android/settings.gradle
@@ -0,0 +1 @@ +include ':app'
diff --git a/examples/platform_services/android/app/build.gradle b/examples/platform_services/android/app/build.gradle index 4e2e46b..90c2899 100644 --- a/examples/platform_services/android/app/build.gradle +++ b/examples/platform_services/android/app/build.gradle
@@ -16,7 +16,7 @@ android { compileSdkVersion 25 - buildToolsVersion '25.0.2' + buildToolsVersion '24.0.1' lintOptions { disable 'InvalidPackage'
diff --git a/examples/platform_services/android/app/src/main/AndroidManifest.xml b/examples/platform_services/android/app/src/main/AndroidManifest.xml index 772377e..37157b7 100644 --- a/examples/platform_services/android/app/src/main/AndroidManifest.xml +++ b/examples/platform_services/android/app/src/main/AndroidManifest.xml
@@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.flutter" + package="com.example.platformservices" android:versionCode="1" - android:versionName="1.0.0" > + android:versionName="0.0.1"> - <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" /> + <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
diff --git a/examples/stocks/android/.gitignore b/examples/stocks/android/.gitignore new file mode 100644 index 0000000..5c4ef82 --- /dev/null +++ b/examples/stocks/android/.gitignore
@@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat
diff --git a/examples/stocks/android/app/build.gradle b/examples/stocks/android/app/build.gradle new file mode 100644 index 0000000..90c2899 --- /dev/null +++ b/examples/stocks/android/app/build.gradle
@@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +}
diff --git a/examples/stocks/android/AndroidManifest.xml b/examples/stocks/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/stocks/android/AndroidManifest.xml rename to examples/stocks/android/app/src/main/AndroidManifest.xml
diff --git a/examples/stocks/android/res/mipmap-hdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-hdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ
diff --git a/examples/stocks/android/res/mipmap-mdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-mdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ
diff --git a/examples/stocks/android/res/mipmap-xhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ
diff --git a/examples/stocks/android/res/mipmap-xxhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xxhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ
diff --git a/examples/stocks/android/res/mipmap-xxxhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xxxhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ
diff --git a/examples/stocks/android/build.gradle b/examples/stocks/android/build.gradle new file mode 100644 index 0000000..d82a154 --- /dev/null +++ b/examples/stocks/android/build.gradle
@@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +}
diff --git a/examples/stocks/android/gradle.properties b/examples/stocks/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/examples/stocks/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/examples/stocks/android/settings.gradle b/examples/stocks/android/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/stocks/android/settings.gradle
@@ -0,0 +1 @@ +include ':app'