Setup freeCodeCamp Mobile App Test Environment

i need some help/explanation to setup a correct enviroinment to compile and run correctly the freeCodeCamp Android Mobile App with linux and flutter. I think i setup all correctly because i’ve compiled in Flutter the mobile app without error but a blank screen appear when i run it. I suppose i have to run a docker app because the presence of the source code in that project but i don’t know how do it. I think i know flutter (because i developed an app) but i do not know how to run docker app on linux. I need some help to set the correct environment to test the app. Thank you and appreciate everyone could help. Massimo

Hey Massimo,

I am glad to hear you want to contribute to the mobile app.

Have you downloaded an emulator from Android Studio? If not, I recommend you do.

Good! I’ve Android Studio installed and the Emulator is OK. When i run the app from VSCode either in the emulator or in a real Android 8.0.0 Phone the result is the same: The app hang at a black screen and nothing happend. No error appear. I suppose ineed to start another piece of software that is in conjunction with the mobile app and in vscode is called “mobile-api”, but i do not know how to do it. Please help!
freeCodeCamp_Mobile_App_ 23-06-2022 23-36

That seems a bit weird to me, I have never experienced that myself before.

You should be able to run the app without the api being run locally.

Have you tried running debug instead of just installing the app and trying to open it?
You can do this by doing the following:

  1. Go to the mobile app directory
    cd mobile-app

  2. Run the app with flutter
    flutter run

There might be some issues with your flutter installation, or you need to download some of the packages.

You can do this by running flutter pub get this will install any missing packages that are needed to run the application.

If that does not work, you can always run flutter doctor, this will give some information on potential problems.

i cloned the reposirtoy, commented the .env file in pubspec.yaml and instructed the suggested command but the result was the same as you may see… any idea?
fCC App 27-06-2022 09-33

Does everything seem “OK” when running flutter doctor ?

Also have you tried waiting a while?

if i wait 5 minutes after

flutter run

nothing happend.
If i run

flutter doctor

everything work fine.

is the correct github project i use?

what’s the flutter version you use? is your version an older version (2.10) ?
can you post your “flutter doctor” output?
thanks!
Massimo

P.S. i saw this in code:
String baseUrl = (await _testservice.developmentMode()) ? 'http://10.0.2.2:3000/' : 'https://api.mobile.freecodecamp.dev/';

does the accesso to api.mobile.freecodecamp.dev need a developer key?

I run the project in debugging mode and i found this:

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Instance of 'FileNotFoundError'
E/flutter ( 3755): #0      DotEnv._getEntriesFromFile
package:flutter_dotenv/src/dotenv.dart:98
E/flutter ( 3755): <asynchronous suspension>
E/flutter ( 3755): #1      DotEnv.load
package:flutter_dotenv/src/dotenv.dart:65
E/flutter ( 3755): <asynchronous suspension>
E/flutter ( 3755): #2      AuthenticationService.setCurrentClientMode
package:freecodecamp/service/authentication_service.dart:92
E/flutter ( 3755): <asynchronous suspension>
E/flutter ( 3755): #3      AuthenticationService.init
package:freecodecamp/service/authentication_service.dart:106
E/flutter ( 3755): <asynchronous suspension>
E/flutter ( 3755): #4      main
package:freecodecamp/main.dart:20
E/flutter ( 3755): <asynchronous suspension>
E/flutter ( 3755):

i suppose could be and authentication problem (need a key) or a different version of flutter.

OHHH!!! OK i solved the problem! I renemed the file

sample.env

in

.env

and everithing gone well. The app started correctly in the emulator.
Mainly was not so clear to me that, in principle i was wrong doing the opposite renaming in the pubspecl.yaml where i renamed .env reference in sample.env (wrong) but the oposite is correct!
Thanks SemBauke for your support and patience with me…

Good to hear you solved the problem!

I forgot to ask if you ran cp sample.env .env, Sorry!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.