In Flutter development, there might be times when you want to rebuild only the Android or iOS part of your project. Here's how you can do it for each platform:
Rebuilding Android:
-
Delete the build folder inside the Android directory:
- Navigate to the root directory of your Flutter project.
- From there, delete the
build
folder inside theandroid
directory using the command:
rm -rf android/app/build
-
Use Flutter build command:
- Still in the root directory of your Flutter project, to build only the Android part, you can use the following commands:
- For APK:
flutter build apk
- For App Bundle:
flutter build appbundle
-
Using Android Studio:
- Open your Flutter project in Android Studio.
- Go to the 'Build' menu and select 'Rebuild Project'.
Rebuilding iOS:
-
Delete the build and DerivedData folders inside the iOS directory:
- Navigate to the root directory of your Flutter project.
- From there, delete the
DerivedData
andbuild
folders inside theios
directory using the commands:
rm -rf ios/DerivedData rm -rf ios/build
-
Use Flutter build command:
- Still in the root directory of your Flutter project, to build only the iOS part, use the following command:
flutter build ios
-
Using Xcode:
- Open the
ios
folder of your Flutter project in Xcode. - From the top menu, select 'Product', then 'Clean Build Folder'. This action removes all the previously compiled files, ensuring a fresh build the next time you compile.
- After that, click the 'Run' button or select 'Product' > 'Build' to rebuild the project. This compiles the project using the latest code and resources.
- Open the
By following these steps, you can rebuild the Android or iOS parts of your Flutter project separately, without affecting the other platform.
Top comments (0)