Skip to content

Commit 9e8defd

Browse files
committed
Fix: deprecated Flutter's Gradle Plugins issue.
Ref: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
1 parent 38788d5 commit 9e8defd

File tree

26 files changed

+439
-277
lines changed

26 files changed

+439
-277
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ android/app/.settings/org.eclipse.buildship.core.prefs
8888
android/app/.settings/org.eclipse.jdt.core.prefs
8989
android/app/google-services-dev.json
9090
android/app/google-services-pro.json
91+
lib/firebase_options.dart
92+
firebase.json

.metadata

+37-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,42 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 68587a0916366e9512a78df22c44163d041dd5f3
8-
channel: unknown
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+
- platform: ios
22+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
23+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
24+
- platform: linux
25+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
26+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
27+
- platform: macos
28+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
29+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
30+
- platform: web
31+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
32+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
33+
- platform: windows
34+
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
35+
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

analysis_options.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

android/.gitignore

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
*.iml
2-
*.class
3-
.gradle
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
46
/local.properties
5-
/.idea/workspace.xml
6-
/.idea/libraries
7-
.DS_Store
8-
/build
9-
/captures
107
GeneratedPluginRegistrant.java
11-
/app/google-services.json
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

+26-22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
id "com.google.gms.google-services"
6+
}
7+
18
def localProperties = new Properties()
29
def localPropertiesFile = rootProject.file('local.properties')
310
if (localPropertiesFile.exists()) {
@@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
613
}
714
}
815

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-
1416
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1517
if (flutterVersionCode == null) {
1618
flutterVersionCode = '1'
@@ -21,25 +23,33 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '1.0'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26-
2726
android {
28-
compileSdkVersion 33
27+
namespace "com.thealphamerc.flutter_twitter_clone"
28+
compileSdk flutter.compileSdkVersion
29+
ndkVersion flutter.ndkVersion
2930

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

3444
defaultConfig {
3545
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3646
applicationId "com.thealphamerc.flutter_twitter_clone"
37-
minSdkVersion 20
38-
targetSdkVersion 29
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.
49+
minSdkVersion 23
50+
targetSdkVersion flutter.targetSdkVersion
3951
versionCode flutterVersionCode.toInteger()
4052
versionName flutterVersionName
41-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42-
multiDexEnabled true
4353
}
4454

4555
buildTypes {
@@ -55,10 +65,4 @@ flutter {
5565
source '../..'
5666
}
5767

58-
dependencies {
59-
testImplementation 'junit:junit:4.12'
60-
androidTestImplementation 'androidx.test:runner:1.1.1'
61-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
62-
implementation 'com.android.support:multidex:1.0.3'
63-
}
64-
apply plugin: 'com.google.gms.google-services'
68+
dependencies {}

android/app/src/debug/AndroidManifest.xml

+3-3
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.thealphamerc.flutter_twitter_clone">
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"/>
+16-20
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,27 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.thealphamerc.flutter_twitter_clone">
3-
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
92
<uses-permission android:name="android.permission.INTERNET"/>
103
<uses-permission android:name="android.permission.CAMERA"/>
114
<application
125
android:label="Fwitter"
6+
android:name="${applicationName}"
137
android:icon="@mipmap/ic_launcher"
14-
android:usesCleartextTraffic="true"
15-
>
8+
android:usesCleartextTraffic="true">
169
<activity
1710
android:name=".MainActivity"
11+
android:exported="true"
1812
android:launchMode="singleTop"
1913
android:theme="@style/LaunchTheme"
2014
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
2115
android:hardwareAccelerated="true"
2216
android:windowSoftInputMode="adjustResize">
23-
<!-- Specifies an Android theme to apply to this Activity as soon as
17+
<!-- Specifies an Android theme to apply to this Activity as soon as
2418
the Android process has started. This theme is visible to the user
2519
while the Flutter UI initializes. After that, this theme continues
2620
to determine the Window background behind the Flutter UI. -->
2721
<meta-data
2822
android:name="io.flutter.embedding.android.NormalTheme"
2923
android:resource="@style/NormalTheme"
3024
/>
31-
<!-- Displays an Android View that continues showing the launch screen
32-
Drawable until Flutter paints its first frame, then this splash
33-
screen fades out. A splash screen is useful to avoid any visual
34-
gap between the end of Android's launch screen and the painting of
35-
Flutter's first frame. -->
36-
<meta-data
37-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
38-
android:resource="@drawable/launch_background"
39-
/>
4025
<meta-data android:name="io.flutter.network-policy"
4126
android:resource="@xml/network_security_config"/>
4227
<intent-filter>
@@ -50,4 +35,15 @@
5035
android:name="flutterEmbedding"
5136
android:value="2" />
5237
</application>
38+
<!-- Required to query activities that can process text, see:
39+
https://developer.android.com/training/package-visibility?hl=en and
40+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
41+
42+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
43+
<queries>
44+
<intent>
45+
<action android:name="android.intent.action.PROCESS_TEXT"/>
46+
<data android:mimeType="text/plain"/>
47+
</intent>
48+
</queries>
5349
</manifest>

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

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.thealphamerc.flutter_twitter_clone
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity()
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-3
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.thealphamerc.flutter_twitter_clone">
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

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
buildscript {
2-
repositories {
3-
google()
4-
jcenter()
5-
}
6-
7-
dependencies {
8-
classpath 'com.android.tools.build:gradle:7.2.1'
9-
classpath 'com.google.gms:google-services:4.3.10'
10-
}
11-
}
12-
131
allprojects {
142
repositories {
153
google()
16-
jcenter()
4+
mavenCentral()
175
}
186
}
197

@@ -25,6 +13,6 @@ subprojects {
2513
project.evaluationDependsOn(':app')
2614
}
2715

28-
task clean(type: Delete) {
16+
tasks.register("clean", Delete) {
2917
delete rootProject.buildDir
3018
}

android/gradle.properties

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
2-
1+
org.gradle.jvmargs=-Xmx4G
32
android.useAndroidX=true
43
android.enableJetifier=true
5-
android.enableR8=true
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Mon Aug 01 13:36:21 IST 2022
21
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
42
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
63
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

0 commit comments

Comments
 (0)