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.

7. Copy the lib directory from old project and other necessary directories, like assets, to your new project.

8. Copy key.properties file of your old project's your-project\android\key.properties to your new project and don't forget to place your keystore (key.jks) file.
Example: D:\key.jks


9. Copy the app icon folders from the res directory in your old project to the res directory of your new project.














10. Open your pubspec.yaml file of new project and add any necessary packages. Define paths for your assets and fonts. Then, run flutter pub get to update your dependencies. Be aware that updates might introduce deprecated classes. If you encounter any errors related to deprecated classes, consult the package documentation or search online for the recommended alternatives to fix them.

11. Let's prepare to build and release your New created Flutter app for Play Store. Follow the instructions below.


A. Include latest version of the Android Material library as a dependency in your app's build.gradle file located at <your-app>/android/app/build.gradle."

Example
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

Popular posts from this blog

Flutter Local Scheduled Notifications

Flutter In-App Purchases one time payment (non consumable) Remove ads Unlock pro premium version: A Code Walkthrough (2025)