Skip to content

Commit 9eac95f

Browse files
committed
chore: Migrated to android gradle plugin
1 parent f3ae5d3 commit 9eac95f

File tree

12 files changed

+116
-59
lines changed

12 files changed

+116
-59
lines changed

.metadata

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6
8-
channel: stable
7+
revision: "300451adae589accbece3490f4396f10bdf15e6e"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
17+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
18+
- platform: android
19+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
20+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

android/app/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

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-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,12 +22,11 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
29-
compileSdkVersion flutter.compileSdkVersion
26+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
27+
namespace "com.example.flutter_template"
28+
compileSdk flutter.compileSdkVersion
29+
ndkVersion flutter.ndkVersion
3030

3131
compileOptions {
3232
sourceCompatibility JavaVersion.VERSION_1_8
@@ -44,6 +44,8 @@ android {
4444
defaultConfig {
4545
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4646
applicationId "com.example.flutter_template"
47+
// You can update the following values to match your application needs.
48+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
4749
minSdkVersion flutter.minSdkVersion
4850
targetSdkVersion flutter.targetSdkVersion
4951
versionCode flutterVersionCode.toInteger()
@@ -91,6 +93,4 @@ flutter {
9193
source '../..'
9294
}
9395

94-
dependencies {
95-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
96-
}
96+
dependencies {}

android/app/src/debug/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter_template">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter_template">
3-
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
42
<application
5-
android:icon="@mipmap/ic_launcher"
6-
android:label="@string/app_name">
3+
android:label="flutter_template"
4+
android:name="${applicationName}"
5+
android:icon="@mipmap/ic_launcher">
76
<activity
87
android:name=".MainActivity"
9-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
108
android:exported="true"
11-
android:hardwareAccelerated="true"
129
android:launchMode="singleTop"
1310
android:theme="@style/LaunchTheme"
11+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
12+
android:hardwareAccelerated="true"
1413
android:windowSoftInputMode="adjustResize">
1514
<!-- Specifies an Android theme to apply to this Activity as soon as
1615
the Android process has started. This theme is visible to the user
1716
while the Flutter UI initializes. After that, this theme continues
1817
to determine the Window background behind the Flutter UI. -->
1918
<meta-data
20-
android:name="io.flutter.embedding.android.NormalTheme"
21-
android:resource="@style/NormalTheme" />
19+
android:name="io.flutter.embedding.android.NormalTheme"
20+
android:resource="@style/NormalTheme"
21+
/>
2222
<intent-filter>
23-
<action android:name="android.intent.action.MAIN" />
24-
<category android:name="android.intent.category.LAUNCHER" />
23+
<action android:name="android.intent.action.MAIN"/>
24+
<category android:name="android.intent.category.LAUNCHER"/>
2525
</intent-filter>
2626
</activity>
2727
<!-- Don't delete the meta-data below.
@@ -30,4 +30,15 @@
3030
android:name="flutterEmbedding"
3131
android:value="2" />
3232
</application>
33+
<!-- Required to query activities that can process text, see:
34+
https://developer.android.com/training/package-visibility?hl=en and
35+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
36+
37+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
38+
<queries>
39+
<intent>
40+
<action android:name="android.intent.action.PROCESS_TEXT"/>
41+
<data android:mimeType="text/plain"/>
42+
</intent>
43+
</queries>
3344
</manifest>

android/app/src/main/kotlin/com/example/flutter_template/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ package com.example.flutter_template
22

33
import io.flutter.embedding.android.FlutterActivity
44

5-
class MainActivity: FlutterActivity() {
6-
}
5+
class MainActivity: FlutterActivity()

android/app/src/main/res/values-night/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

android/app/src/profile/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter_template">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

android/build.gradle

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.20'
1+
allprojects {
32
repositories {
43
google()
54
mavenCentral()
65
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
126
}
137

14-
allprojects {
15-
repositories {
16-
google()
17-
mavenCentral()
8+
rootProject.buildDir = '../build'
9+
10+
11+
// [NStack] the namespace property is null within
12+
// the android block of the build.gradle file for the nstack sdk.
13+
// Additionally, the Kotlin Gradle plugin is using a very old version there.
14+
subprojects {
15+
afterEvaluate { project ->
16+
if (project.name == 'nstack') {
17+
if (project.hasProperty('android')) {
18+
project.android {
19+
if (namespace == null) {
20+
namespace project.group
21+
}
22+
}
23+
project.buildscript {
24+
dependencies {
25+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
26+
}
27+
}
28+
}
29+
}
1830
}
1931
}
32+
// End of NStack workaround
33+
2034

21-
rootProject.buildDir = '../build'
2235
subprojects {
2336
project.buildDir = "${rootProject.buildDir}/${project.name}"
2437
}

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx4G
22
android.useAndroidX=true
33
android.enableJetifier=true

0 commit comments

Comments
 (0)