FAQ (Frequently Asked Questions)
1. How do I change the app name?
- Answer:
To change the app name, you can either use the customization script or manually update it:- Using the Script: Update the
app_name
field in thecustomization.yaml
file and run:bashrps customize --appName-only
- Manually: Open the
AndroidManifest.xml
file located atandroid/app/src/main/AndroidManifest.xml
and modify theandroid:label
attribute.
- Using the Script: Update the
2. How do I update the app's package name?
- Answer:
The package name can be updated using the customization script or manually:- Using the Script: Update the
package_name
field in thecustomization.yaml
file and run:bashrps customize --packageName-only
- Manually: Replace all instances of the old package name with the new one:
- Navigate to
android/app/src/main/kotlin/com/example/acnoo_pharmacy_app/MainActivity.kt
. - Press
Ctrl + Shift + R
(or equivalent shortcut) to replace the old package name with the new one across the entire project. - Ensure the new package name follows the structure (e.g.,
com.yourcompany.yourappname
).
- Navigate to
- Using the Script: Update the
3. How do I change the backend API URL?
- Answer:
You can update the backend API URL either manually or by using the customization script.
Option 1: Manually Update the baseUrl
- Open the
_app_config.dart
file located at/lib/app/core/static/app_config/_app_config.dart
. - Modify the
baseUrl
constant:dartconst String baseUrl = 'https://your-new-domain.com';
Option 2: Use the Customization Script
The app includes a powerful customization script that allows you to easily update the backend API URL along with other configurations. Follow these steps:
Prepare Your
customization.yaml
File- Locate the
customization.yaml
file in the root directory of the project. - Open the file and update the
base_url
field:yamlbase_url: "https://your-new-domain.com"
- Locate the
Run the Script
- Open a terminal in the root directory of the project.
- Use the following command to run the script:bash
rps customize --baseUrl-only
- This will update only the
baseUrl
without affecting other configurations.
Verify Changes
- Restart the app to ensure the new backend API URL is applied.
- Test the app to confirm it connects successfully to the updated domain.
Note: Make sure to replace
https://your-new-domain.com
with the correct URL of your backend API. And Remember NOT put a slash (/
) at the end of the url.
4. What should I do if flutter doctor
shows errors?
- Answer:
Ifflutter doctor
reports issues:- Address each error individually:
- For missing Android licenses, run:bash
flutter doctor --android-licenses
- For missing dependencies, install the required tools (e.g., Android SDK Command Line Tools).
- For missing Android licenses, run:
- After resolving the issues, re-run
flutter doctor
to verify that everything is configured correctly.
- Address each error individually:
5. How do I add a new language for localization?
- Answer:
To add a new language:- Duplicate an existing
.i18n.json
file (e.g.,en.i18n.json
) and rename it to match the new language code (e.g.,fr.i18n.json
for French). - Translate the strings in the new file.
- Run the following command to update the localization classes:bash
dart run slang
- Restart the app to apply the changes.
- Duplicate an existing
6. Why are my translations not updating in the app?
- Answer:
If translations are not updating:- Ensure all
.i18n.json
files have consistent keys. - Run the following command to regenerate the localization classes:bash
dart run slang
- Hot-reload or restart the app to see the changes.
- Ensure all
7. How do I replace the onboarding screen images?
- Answer:
To replace the onboarding screen images:- Navigate to the
/assets/images/onboard
folder. - Replace the existing images (
onboard_01.png
,onboard_02.png
,onboard_03.png
) with your custom ones. - Ensure the new images are in
.png
format and have the same filenames. - Restart the app to see the updated images.
- Navigate to the
8. How do I change the app icon?
- Answer:
To change the app icon:- Replace the existing icon files in the
/assets/app
folder (app_icon.png
,app_launcher_icon.png
). - Run the customization script:bash
rps customize --icon-only
- Restart the app to see the updated icon.
- Replace the existing icon files in the
9. What should I do if the app crashes after making changes?
- Answer:
If the app crashes:- Check the terminal or console for error messages.
- Use
flutter clean
to clear cached files and then run:bashflutter pub get
- Verify that all customizations (e.g., package name, API URL) are correctly applied.
- Test the app on a different device or emulator to rule out device-specific issues.
10. How do I build a release APK?
- Answer:
To build a release APK:- Open a terminal and navigate to the project directory.
- Run the following command:bash
flutter build apk --release
- Locate the APK in the
build/app/outputs/flutter-apk/
directory.
11. Why is my app not connecting to the backend?
- Answer:
If the app fails to connect to the backend:- Verify the
baseUrl
in_app_config.dart
is correct. - Ensure the backend server is running and accessible.
- Check network permissions in the
AndroidManifest.xml
file:xml<uses-permission android:name="android.permission.INTERNET" />
- Verify the
12. How do I test the app on a physical device?
- Answer:
To test the app on a physical device:- Enable Developer Options and USB Debugging on your Android device.
- Connect the device to your computer via USB.
- Run the following command to list connected devices:bash
flutter devices
- Start the app on the device:bash
flutter run
13. What should I do if I encounter missing dependencies?
- Answer:
If you encounter missing dependencies:- Run the following command to fetch dependencies:bash
flutter pub get
- If the issue persists, delete the
pubspec.lock
file and runflutter pub get
again. - Ensure your Flutter SDK is up-to-date by running:bash
flutter upgrade
- Run the following command to fetch dependencies: