Easy migration of old Flutter project to the latest version by creating a brand new flutter project | java to kotlin - null safety - material3 - embedding android v2 - all migrations at once
The easiest way to upgrade your Flutter project is to create a new project, then migrate your existing project files to the latest version. As a result, all your files will be automatically updated to the latest compatibility standards.😎
Here we'll guide you step-by-step. Please follow each step carefully.
1. Open the old app that you want to upgrade.
2. Upgrade the Flutter, run flutter upgrade In your terminal to upgrade to the latest version of the Flutter SDK.
3. Copy the package name/applicationId from android/app/build.gradle file in your old flutter project we use it later.
4. Create a brand new Flutter app project inside a new directory/folder with the same name as your old project by following the below image instructions.
5. In both your new and old Flutter projects, open the android/app/build.gradle file and ensure the applicationId value is identical.
6. Open the AndroidManifest.xml file of new project and add the INTERNET permission and any other necessary permissions to your new project.
dependencies {
implementation 'com.google.android.material:material:1.11.0'
}
<version> put the latest version of the Android Material library.
To find out the latest version, visit https://maven.google.com/web/index.html#com.google.android.material:material
B. To configure Gradle to use your upload key during release builds, copy green colored lines past it in your-project/android/app/build.gradle file Before the android block.
Example
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
...
}
C. Just find the buildTypes block in your-project/android/app/build.gradle file.
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
}
}
Copy below green colored lines and Replace it with the above lines:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
You can now release your new Flutter app on Google Play. I recommend starting with internal testing mode first.
Comments
Post a Comment