Search code examples
importflutterproject

How to properly import Open Source projects in Flutter?


I am learning Flutter and I would like to import an Open Source project to learn some of the structure etc.

The project is: https://github.com/matthewtory/trinity-orientation-2018

I am using Android Studio, and so far I can create my own projects and run them via my phone but when I want to import this project I am getting a lot of errors and warnings. The app is finished and also on the play store, so why doesn't it run in my IDE? Am I missing something?

Error message is:

Launching lib\main.dart on SM G960F in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\marcs\AndroidStudioProjects\trinity-orientation-2018-master\android\gradlew.bat" exited abnormally:
firebase_storage
firebase_messaging
url_launcher
camera
path_provider
cloud_firestore
shared_preferences
image_picker
firebase_core
firebase_auth


FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\marcs\AndroidStudioProjects\trinity-orientation-2018-master\android\app\build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> versionCode not found. Define flutter.versionCode in the local.properties file.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
  Command: C:\Users\marcs\AndroidStudioProjects\trinity-orientation-2018-master\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

I downloaded the project and imported the folder in Android Studio. It first asked to get the dependencies which I did and immediately, I tried to run it on my phone.

Feel free to check the code on the Github project. I have not changed anything. I hope to run this project to learn about animation and navigation concepts.


Solution

  • The error message says you have to define version code. Try to add below lines to your local.properties file (under android folder)

    flutter.versionName=1.0.0

    flutter.versionCode=1

    You may get other errors but at least this will fix the error in your question. Share other error message if you get.