Importing a Project from Github and Running It on Educative
We'll cover the following
Setting up our application
In this lesson, we will set up an Android widget to run a Flutter App imported and cloned a json example application from GitHub. In the previous lesson, it was discussed that how we can use a sample app to test flutter. In this lesson, we will import a project from Github and use it in the Android widget.
Cloning the project
After selecting Android Widget and following the steps to select Flutter Framework. Now press Import code from Github
button and paste the GitHub repository link in the text box, and hit Apply.
After applying you will see multiple folders and files appear in the code directory.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="dev.flutter.jsonexample"> <!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. --> <uses-permission android:name="android.permission.INTERNET"/> </manifest>
Copy the package name and paste it in the Package name dialog box in Android Widget editor view.
cd /usercode && flutter upgrade && flutter build apk --debug --target-platform=android-arm && echo EDSTATUSCODE 1 && echo Build Completed
- cd /usercode && flutter upgrade: Moving to our /usercode directory and upgrading flutter to latest version 2.10.5
- flutter build apk --debug --target-platform=android-arm: builds the apk for the project using flutter build apk --debug --target-platform=android-arm command.
- echo EDSTATUSCODE 1 && echo Build Completed : echo EDSTATUSCODE 1 && echo Build Completed. This command connects the virtual device and installs the apk on it and relaunches the virtual device (Genymotion).
Lets Run this code
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="dev.flutter.jsonexample"> <!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. --> <uses-permission android:name="android.permission.INTERNET"/> </manifest>
Note: The above project may take upto 6 minutes because we are upgrading flutter to latest version as it is the requirement of the project.