pariyatti / mobile-app

The Pariyatti mobile app
https://pariyatti.app/
GNU Affero General Public License v3.0
8 stars 11 forks source link

vscode build is failing #61

Open bksubhuti opened 2 years ago

bksubhuti commented 2 years ago

I tried to clone this and compile but there are many errors.
i'm using flutter 2.5.1

Is there missing code? small sample (problems 66) image

bksubhuti commented 2 years ago

I still cannot debug this.. but flutter packages pub run build_runner build helped solve many problems.. this needs to be in the MD file. Still cannot run the code

Target file "lib/main_sand.dart" not found.

deobald commented 2 years ago

Hello Bhikkhu Subhuti,

It might be easier to diagnose your problems if we have a call? I work on the Pariyatti Open Source projects on Saturdays and I am currently in Atlantic Daylight Time.

In the meantime, can you describe which step in the README setup process you reached? It will also be useful if you can copy/paste the entire output of the failing build step as plaintext.

I will need to know what operating system, terminal, and iOS or Android version you are using to help you diagnose the problem.

The sandbox server (used by main_sand.dart) is not currently running because we are in the process of changing the API. (The app is not released yet and we wanted to paginate the results.) You will need to stand up the web service locally and configure the mobile app to point to it in Environment.dart — as I said, it is probably easier if I guide you through this on a call, if you are available. :)

I am not a mobile app developer and I'm just learning Flutter now myself, so I apologize if the process is somewhat awkward. The original developers who built the Flutter app are unavailable at the moment.

I am traveling today and typing this response on a phone, but I will return to the city this evening.

Take care, -steven

PS: On short notice, you can reach me on Signal, Telegram, and WhatsApp via my India number: +91 98450 61456

deobald commented 2 years ago

@bksubhuti As I'm looking through the Makefile, I'm recalling that much of the build automation was done (by me) early in the project, before I understood how Flutter worked at all. I was also predominantly on Linux+Android at the time and I now do most of my Pariyatti development on MacOS+iOS.

It's very likely that misordered steps are my mistake due to ignorance and switching environments. I would appreciate your help in normalizing (with whatever is considered "normal" for Flutter development) the build automation so other developers don't have the trouble you are having.

I used the Flutter build process as recently as Saturday with @alokkhs on his MacOS+Android dev env and we did have the app running without any additional flutter commands, but I've noticed that both Flutter packages and XCode can be incredibly fragile, so it's likely there's some build step instruction which needs tightening up.

If you are building on XCode you will need to change your Team to your personal Apple Developer account. There was a licensing issue this past weekend and we needed @brihas to agree to an Apple policy change before we could build with the Pariyatti Team profile, thus, the code in the development branch uses my personal Apple Developer account, which won't work for others.

A final note: for some reason, the mobile app developer community seems to use development as a mainline branch and release from master. I don't intend to keep this branching model but we have 2 open PRs which need to be merged into development before I can switch to trunk-based development on master. Please make sure you are building from the development branch in the meantime.

bksubhuti commented 2 years ago

Please understand that this email you sent to me was public (with your phone number). Normal for me and most other people means that you DO NOT have flutter setup in the read.me file. Instead, direct them to the standard flutter dev page which tells people how to setup flutter. https://flutter.dev/docs/get-started/install

The next thing you would want to do is NOT require the user to run commands to have compilable files. It is best if these are checked in files. (like the moor stuff). Lastly, running a release build is rare. Uploading to the play store is rare. It should only be lead developer actions. The default should be set up so that it opens in vscode, you click on a file , hit debug.

I have no idea how to change the channel. I too am new to flutter and know enough to make a small app (Buddhist Sun) and guide a programmer. You should be developing in stable channel of Flutter. The read.me has too much information and is not really vscode friendly and assume everyone has an expensive apple computer.

When I need to run a build for the play store on our app (Tipitaka Pali Reader), I change a few lines and then rollback those changes after finished so that nobody else gets compile errors. So default should be development and debug.

If I want to make a release build.. I just type flutter build apk and I have a release. I'm not sure what you are doing although I saw a video about different builds for debug and release. I guess you are doing that.

deobald commented 2 years ago

There are quite a few points here, so I've broken them into headings to help identify what we are discussing at any given point.

Public Phone Number

Please understand that this email you sent to me was public (with your phone number).

I replied on GitHub; the email you received is from GitHub, not me. I understand it is public and I am fine with that — my phone numbers and email addresses are both very public information. I know most people are not comfortable with this kind of transparency, however — thank you for expressing your concern. :)

Flutter Setup

Normal for me and most other people means that you DO NOT have flutter setup in the read.me file. Instead, direct them to the standard flutter dev page which tells people how to setup flutter. https://flutter.dev/docs/get-started/install

This is precisely what we do, in Step 3 of both the Android and iOS setup instructions:

https://github.com/pariyatti/mobile-app#dev-setup-android

There are no additional Flutter setup instructions for Android but the additional instructions for iOS / MacOS were necessary for me to get an iOS build working. Perhaps I'm not understanding the issue, however, if you want to elaborate?

Generated Files in Source Control

The next thing you would want to do is NOT require the user to run commands to have compilable files. It is best if these are checked in files. (like the moor stuff).

This is an option to consider, though in most development environments it's preferable to avoid committing generated files to source control as long as the process which generates them is deterministic. If committing generated files is a common practice in Flutter development I'm happy to check them in, but I would want to confirm that first. Could you point me to some literature which would suggest this is a good idea for Flutter?

Running a Debug Build

Uploading to the play store is rare. It should only be lead developer actions. The default should be set up so that it opens in vscode, you click on a file , hit debug.

make build and make run will open the application in debug mode on a mobile device connected to your computer via USB. There is nothing in the instructions which suggests you should attempt to use an IDE to build the software or upload to the Play Store:

https://github.com/pariyatti/mobile-app#local-build-process

Again, am I misunderstanding something?

Code Editors

The default should be set up so that it opens in vscode, you click on a file , hit debug.

I'm not sure which "default" you are referring to. Could you point me to a line number in the README which you are discussing here? We cannot assume anyone has vscode (or any other editor) installed for the purposes of the build process, which is why it's driven by make. I am aware many developers use vscode but all of the volunteers on this project thus far have used Android Studio. We can add vscode installation instructions to the Android Dev Setup (https://github.com/pariyatti/mobile-app#dev-setup-android), if you are familiar with vscode and would like to contribute them?

Flutter Channels

I have no idea how to change the channel. I too am new to flutter and know enough to make a small app (Buddhist Sun) and guide a programmer. You should be developing in stable channel of Flutter.

I will be sure to try your app! :)

I'm not sure why you are trying to change your Flutter Channel; we are currently on Flutter Stable. This is the version output I receive locally:

steven@solasa mobile-app % flutter --version
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git

Again, forgive me if I've misunderstood the issue. Perhaps you could elaborate on what you are trying to accomplish which requires changing Flutter channels?

README

The read.me has too much information and is not really vscode friendly and assume everyone has an expensive apple computer.

This has three parts.

(1) Too much information: There is a lot of information in the README because I find that it is better to document heavily, for my own benefit, than to leave things to my memory. I apologize if the README is verbose, but I am sometimes unable to work on this project for weeks or months at a time, due to other responsibilities. When I return to the project, I often forget how Flutter works — heavy documentation helps me reorient myself, especially if I have switched computers, countries, or operating systems.

(2) vscode: Please see above. None of the existing developers have ever used vscode so we do not know how to configure it. I would quite happily accept a patch which explains how to configure vscode for this project, if you are interested in submitting one.

(3) Apple Computers: This is not up to me or anyone else on the team. To build a Flutter application for iOS requires an Apple computer running a recent version of MacOS — Apple does not allow other operating systems to compile iOS code. When I initially wrote the README, I was using an 8-year-old ThinkPad running Linux and a 12-year-old MacBook Air. That is still my primary Linux environment but the MacBook Air was incapable of building iOS apps, so the README reflects the current MacBook I am using. The Apple/iOS/XCode-specific instructions are only for the iOS builds. Anyone can build the Flutter app for Android using Linux and the instructions in the Dev Setup: Android section. Unless you intend to build the mobile app for iOS locally, you can ignore the Dev Setup: iOS section entirely.

Play Store Deployment

When I need to run a build for the play store on our app (Tipitaka Pali Reader), I change a few lines and then rollback those changes after finished so that nobody else gets compile errors. So default should be development and debug.

I have not tried Tipitaka Pāli Reader — I will have to try this app sometime, too. :)

The default is development and debug. Please see the Running a Debug Build section, above.

Deployment should never be the responsibility of a local computer like a laptop or a desktop, since these environments are constantly in flux and thus deployments become non-deterministic. All deployments (of all software, whether mobile, web, or desktop) should happen on a consistent build environment called a continuous integration and deployment server. For this purpose, we use a service called CodeMagic. Unless for testing/experimental purposes, we do not deploy to the Play Store or App Store from a local environment.

The code checked into the development branch in source control is for development and debugging, not for App and Play Store releases. It would help diagnose your problem if you could explain where you are seeing something to the contrary.

APKs, Debug vs. Release

If I want to make a release build.. I just type flutter build apk and I have a release. I'm not sure what you are doing although I saw a video about different builds for debug and release. I guess you are doing that.

Since iOS has no concept comparable to Android's APK, we will unfortunately have to deploy beta builds through the App and Play Stores to ensure we test on both iOS and Android. Even if we weren't doing this, it would still be wise to use a continuous deployment server to create APKs. You will see one demo APK in the GitHub releases section of the repository: https://github.com/pariyatti/mobile-app/releases/tag/2020-08-demo ... please ignore this. The demo APK was only used to demonstrate the app to Pariyatti staff back in 2020, prior to the project commencing in earnest. We do not use the GitHub releases channel or APKs for releases or testing in general, since this requires beta users to configure a Developer mode on their phones, which is too arduous for them.

Conclusion

I hope this explanation makes sense. Again, it is probably easiest if you and I could have a call sometime to sort out these issues — it sounds like there are perhaps some fundamental confusions about how the app is (or should be) built and debugged locally. A call would also help me ascertain what excites you most about this project, how familiar you are with its goals, and how we can work together to grow the mobile app. :)

I will be in the United Kingdom from Nov. 1st to 9th and I'm otherwise in Atlantic Daylight Time. I'm happy to speak with you on any weekend you are free. 🙏

bksubhuti commented 2 years ago

You are quite verbose and so is the MD file, yet i do not have information to build with vscode.

  1. Please download vscode and setup emulator for android (do not list these standard steps for me)
  2. Clone the app in a new directory.
  3. Tell me all the steps you took to make vscode debug with android emulator. including command lines and file renames, etc.
  4. With your information I should be able to run command statements, open a specified main dart file you tell me to open. I should be able hit the debug button which will build and run the code.