Skip to content

Commit 0554fc0

Browse files
committed
Upgrade to Android embeddings v2
1 parent c7c85e2 commit 0554fc0

File tree

16 files changed

+114
-71
lines changed

16 files changed

+114
-71
lines changed

android/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

android/app/build.gradle

+22-5
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,33 @@ if (flutterVersionName == null) {
2222
}
2323

2424
apply plugin: 'com.android.application'
25+
apply plugin: 'kotlin-android'
2526
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2627

2728
android {
28-
compileSdkVersion 28
29+
compileSdkVersion flutter.compileSdkVersion
30+
ndkVersion flutter.ndkVersion
2931

30-
lintOptions {
31-
disable 'InvalidPackage'
32+
compileOptions {
33+
sourceCompatibility JavaVersion.VERSION_1_8
34+
targetCompatibility JavaVersion.VERSION_1_8
35+
}
36+
37+
kotlinOptions {
38+
jvmTarget = '1.8'
39+
}
40+
41+
sourceSets {
42+
main.java.srcDirs += 'src/main/kotlin'
3243
}
3344

3445
defaultConfig {
3546
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3647
applicationId "com.thealphamerc.flutter_github_connect"
37-
minSdkVersion 17
38-
targetSdkVersion 29
48+
// You can update the following values to match your application needs.
49+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50+
minSdkVersion flutter.minSdkVersion
51+
targetSdkVersion flutter.targetSdkVersion
3952
versionCode flutterVersionCode.toInteger()
4053
versionName flutterVersionName
4154
}
@@ -52,3 +65,7 @@ android {
5265
flutter {
5366
source '../..'
5467
}
68+
69+
dependencies {
70+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71+
}

android/app/src/debug/AndroidManifest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.thealphamerc.flutter_github_connect">
3-
<!-- Flutter needs it to communicate with the running application
2+
package="com.thealphamerc.flutter_github_connect.app">
3+
<!-- The INTERNET permission is required for development. Specifically,
4+
the Flutter tool needs it to communicate with the running application
45
to allow setting breakpoints, to provide hot reload, etc.
56
-->
67
<uses-permission android:name="android.permission.INTERNET"/>

android/app/src/main/AndroidManifest.xml

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.thealphamerc.flutter_github_connect">
3-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4-
calls FlutterMain.startInitialization(this); in its onCreate method.
5-
In most cases you can leave this as-is, but you if you want to provide
6-
additional functionality it is fine to subclass or reimplement
7-
FlutterApplication and put your custom class here. -->
8-
<uses-permission android:name="android.permission.INTERNET"/>
9-
<application
10-
android:name="io.flutter.app.FlutterApplication"
2+
package="com.thealphamerc.flutter_github_connect.app">
3+
<application
114
android:label="Git Connect"
5+
android:name="${applicationName}"
126
android:icon="@mipmap/ic_launcher">
137
<activity
148
android:name=".MainActivity"
9+
android:exported="true"
1510
android:launchMode="singleTop"
1611
android:theme="@style/LaunchTheme"
1712
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -25,15 +20,6 @@
2520
android:name="io.flutter.embedding.android.NormalTheme"
2621
android:resource="@style/NormalTheme"
2722
/>
28-
<!-- Displays an Android View that continues showing the launch screen
29-
Drawable until Flutter paints its first frame, then this splash
30-
screen fades out. A splash screen is useful to avoid any visual
31-
gap between the end of Android's launch screen and the painting of
32-
Flutter's first frame. -->
33-
<meta-data
34-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
35-
android:resource="@drawable/launch_background"
36-
/>
3723
<intent-filter>
3824
<action android:name="android.intent.action.MAIN"/>
3925
<category android:name="android.intent.category.LAUNCHER"/>

android/app/src/main/java/com/thealphamerc/flutter_github_connect/MainActivity.java

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.thealphamerc.flutter_github_connect.app
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity() {
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
the Flutter engine draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<!-- Theme applied to the Android Window while the process is starting -->
4-
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4+
<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.
1010
This theme determines the color of the Android Window while your
1111
Flutter UI initializes, as well as behind your Flutter UI while its
1212
running.
13-
13+
1414
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15-
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16-
<item name="android:windowBackground">@android:color/white</item>
15+
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
1717
</style>
1818
</resources>

android/app/src/profile/AndroidManifest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.thealphamerc.flutter_github_connect">
3-
<!-- Flutter needs it to communicate with the running application
2+
package="com.thealphamerc.flutter_github_connect.app">
3+
<!-- The INTERNET permission is required for development. Specifically,
4+
the Flutter tool needs it to communicate with the running application
45
to allow setting breakpoints, to provide hot reload, etc.
56
-->
67
<uses-permission android:name="android.permission.INTERNET"/>

android/build.gradle

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
buildscript {
2+
ext.kotlin_version = '1.6.10'
23
repositories {
34
google()
4-
jcenter()
5+
mavenCentral()
56
}
67

78
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.6.4'
9+
classpath 'com.android.tools.build:gradle:7.1.2'
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
911
}
1012
}
1113

1214
allprojects {
1315
repositories {
1416
google()
15-
jcenter()
17+
mavenCentral()
1618
}
1719
}
1820

android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

android/settings.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Copyright 2014 The Flutter Authors. All rights reserved.
2-
// Use of this source code is governed by a BSD-style license that can be
3-
// found in the LICENSE file.
4-
51
include ':app'
62

73
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")

android/settings_aar.gradle

-1
This file was deleted.

0 commit comments

Comments
 (0)