Application Permissions & Dependencies

Make sure the below-mentioned permissions are allowed or accepted:

  1. Internet access

  2. FileStore read and write

  3. Bluetooth connection

  4. Request packages

  5. Query all packages

Code Snippet

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

Steps To Setup The Project

Install Android Studio for setting the IDE.

Open Android Studio. Open plugin preferences (File > Settings > Plugins) and select Marketplace. Select the Flutter plugin and click Install as shown in the image below. Click Yes when prompted to install the Dart plugin.

Set the Flutter SDK path in android studio by navigating to (File > Settings > Plugins > Language & Frameworks >>flutter) flutter as shown in the image below.

Add the flutter path to the system path variable for running the flutter commands as shown in the image below.

Open a new terminal and run the flutter doctor command. This downloads the respective Dart SDK version and runs flutter doctor--android-licenses to accept the android licenses.

The steps below guide us to run the project on both Web and Mobile 1. Clone the project from the Git repo. 2. Open the project in android studio by selecting (File > open), select the flutter project (punjab-mgramseva/frontend/mgramseva) from the cloned path as shown in the image below.

Running On Android Emulator

Select the AVD manager from the right-side top corner as shown in the image. Now, select any device by tapping on the play button. The Android Studio launches the emulator and the device is auto-selected. There are two modes for running the application - play and debug. Tap on any one of the modes to launch the mGramSeva application in the emulator as shown in the image.

Running On Web

Select the chrome option from the device selection and tap on the play button. This launches the application on a chrome window.

Note: To resolve the cors error follow the steps provided in this link.

Build Prod App Bundle - Steps

  1. Navigate to mgramseva folder → cd punjab-mgramseva/frontend/mgramseva

  2. Upgrade the version in the pubspec.yml (version: 1.0.2+3) 1.0.2 => version name (which is displayed in play store)

    +3 => version code (increment by +1 every time)

  3. Comment the below line File → link export 'dart:js' show allowInterop, allowInteropCaptureThis;

  4. Execute the flutter clean command → flutter clean

  5. Execute the flutter pub get command → flutter pub get

Steps To Run The Integration Test On Android Device

1. Enable the USB debugging option on your Mobile Phone. (Reference Link )

2. Connect your Phone to the system and enable File transfer.

3. Select the AVD manager(your Phone) from the right side top corner in Android Studio

4. Go to the frontend/mgramseva/utils/execute_integration.sh file and run it.

5. Integration test will start on your device.

Last updated