Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppFlowy build tasks for Android platform #3184

Closed

Conversation

rileyhawk1417
Copy link
Collaborator

@rileyhawk1417 rileyhawk1417 commented Aug 13, 2023

Feature Preview

  • This PR is related to AppFlowy Editor, so its in preparation for when AppFlowy Editor supports the mobile version. The PR just has the build tasks to make it run on android.
  • There is one issue with it working on Windows platform. The rust backend does not compile for android, otherwise there's nothing wrong with the dart(frontend) part.

PR Checklist

  • My code adheres to the AppFlowy Style Guide
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

@codecov
Copy link

codecov bot commented Aug 13, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (62f1d6e) 11.98% compared to head (4801da7) 66.57%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3184       +/-   ##
===========================================
+ Coverage   11.98%   66.57%   +54.58%     
===========================================
  Files         540      540               
  Lines       25239    25274       +35     
===========================================
+ Hits         3026    16826    +13800     
+ Misses      22213     8448    -13765     
Flag Coverage Δ
appflowy_flutter_integrateion_test 64.60% <ø> (?)
appflowy_flutter_unit_test 11.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 400 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -43,6 +43,16 @@
},
"cwd": "${workspaceRoot}/appflowy_flutter"
},
{
"name": "AF-iOS: Build Dart Only",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this task just for people who want to run AppFlowy, without rebuilding the backend

@LucasXu0
Copy link
Collaborator

@rileyhawk1417 Can you provide more details on the instructions?

I encountered this error.

error: Could not find any NDK.
note: Set the environment ANDROID_NDK_HOME to your NDK installation's root directory,
or install the NDK using Android Studio.

@rileyhawk1417
Copy link
Collaborator Author

@LucasXu0 I had put instructions in a README inside the android folder. Haven't tested it on MacOS yet, but am sure the setup is similar to that of Linux.

@rileyhawk1417 Can you provide more details on the instructions?

I encountered this error.

error: Could not find any NDK.
note: Set the environment ANDROID_NDK_HOME to your NDK installation's root directory,
or install the NDK using Android Studio.

The error is related to the Android NDK not being found, its what is used to compile the rust backend for android.

@AkechiShiro
Copy link

AkechiShiro commented Sep 2, 2023

@LucasXu0 I believe you should look into the readme that was modified in the commits, there seems TL be a list of requirements where Android NDK is mentioned along other stuff, something called cargo-ndk as well.

Getting the tools

Install cargo-ndk bash cargo install cargo-ndk.

Android NDK .

When downloading Android NDK you can get the compressed version as a standalone from the site. Or you can download it through Android Studio.

After downloading the two you need to set the environment variables. For Windows that's a separate process. On macOS and Linux the process is similar.

The variables needed are '$ANDROID_NDK_HOME', this will point to where the NDK is located.

If I understand correctly, the app is written with a blend of Flutter (Dart) and Rust as well, I don't understand just which kind of part is written in Rust (what is that part achieving ?).

I've stumbled on this project and I'm interesting in having it working on Android, just keeping an eye on this PR since this brings good progress towards building a mobile application.

@rileyhawk1417 Is it recommended in order to test this PR, to use VSCode ? I saw some files related to it.

@rileyhawk1417
Copy link
Collaborator Author

@AkechiShiro there's an article explaining about how flutter & rust work together in the app. As for the testing part of VSCode well its not necessary but it just makes things easier for development, you can run the VSCode tasks individually on a separate terminal.

@@ -84,6 +84,34 @@
"cwd": "${workspaceFolder}"
}
},
{
"label": "AF: Clean + Rebuild All (Android)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's easier to see if you're running the right task, if the label include critical information at the beginning.

Suggested change
"label": "AF: Clean + Rebuild All (Android)",
"label": "AF-Android: Clean + Rebuild All",

}
},
{
"label": "AF: Build Appflowy Core For Android",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"label": "AF: Build Appflowy Core For Android",
"label": "AF-Android: Build Appflowy Core",

@Xazin
Copy link
Collaborator

Xazin commented Oct 4, 2023

Do you have a take on this PR @LucasXu0 ?

@rileyhawk1417
Copy link
Collaborator Author

Updated the debug labels & added a .gitignore for the android build files.

@rileyhawk1417
Copy link
Collaborator Author

It did fail to build the flowy test crate with this error:

warning: field `storage_service` is never read
  --> flowy-document2/src/manager.rs:35:3
   |
29 | pub struct DocumentManager {
   |            --------------- field in this struct
...
35 |   storage_service: Weak<dyn FileStorageService>,
   |   ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

   Compiling flowy-core v0.1.0 (/home/riley/Documents/Github_Repos/appFlowy/app/appflowy/frontend/rust-lib/flowy-core)
warning: `flowy-document2` (lib) generated 1 warning
   Compiling flowy-test v0.1.0 (/home/riley/Documents/Github_Repos/appFlowy/app/appflowy/frontend/rust-lib/flowy-test)
error[E0599]: no method named `get_cloud_service` found for struct `Arc<DocumentManager>` in the current scope
  --> flowy-test/src/lib.rs:90:47
   |
90 |     let cloud_service = self.document_manager.get_cloud_service().clone();
   |                                               ^^^^^^^^^^^^^^^^^ method not found in `Arc<DocumentManager>`

I did pull from the latest code so maybe something is missing?

@rileyhawk1417
Copy link
Collaborator Author

Closing this PR as its been solved by this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants