logseq/android
Andelf e19f574f4f chore: bump version 0.6.4 2022-03-19 19:14:02 +08:00
..
app chore: bump version 0.6.4 2022-03-19 19:14:02 +08:00
gradle/wrapper fix: check in gradle wrapper 2021-09-30 13:10:07 +08:00
.gitignore feat: init ios/android template 2021-09-28 14:58:43 +08:00
README.md add readme 2021-12-03 18:12:27 +08:00
build.gradle feat: init ios/android template 2021-09-28 14:58:43 +08:00
capacitor.settings.gradle fix(android): only encode url on iOS 2022-01-06 18:46:31 +08:00
gradle.properties dev(mobile): more heap memory for gradle building 2021-11-25 16:22:56 +08:00
gradlew fix: check in gradle wrapper 2021-09-30 13:10:07 +08:00
gradlew.bat feat: init ios/android template 2021-09-28 14:58:43 +08:00
settings.gradle feat: init ios/android template 2021-09-28 14:58:43 +08:00
variables.gradle fix(mobile): file permissions 2021-11-27 21:19:07 +08:00

README.md

Set up development environment

  • Install Android studio [^1] and SDK (newer than 30) tools Note: for M1 MacBook users.
    • Download version Mac with Apple Chip
    • unzip it and move Android Studio.app file to Applications, or you will get the following error later.
      [error] Unable to launch Android Studio. Is it installed?
         Attempted to open Android Studio at: /Applications/Android Studio.app
         You can configure this with the CAPACITOR_ANDROID_STUDIO_PATH environment variable.
      
  • In Android Studio, open Tools -> SDK Manager to install other SDK tools [^2].

    In the SDK Tools tab, make sure to install at least the following:

    • Android SDK Build-Tools
    • Android SDK Command-line Tools
    • Android Emulator
    • Android SDK Platform-Tools

Build the development app in Android emulator

  • Replace server url with your local-ip-address:3001 (run ifconfig to check) in capacitor.config.ts.
  • Run yarn && yarn app-watch from the logseq project root directory in terminal.
  • Run npx cap sync android in another termimal (all-in-one cmd).
  • In Android Studio, open Tools -> AVD Manager to create Android Virtual Device (AVD), and lanuch it in the emulator.
  • In Android Studio, open Run -> Run to run Logseq.
  • After logseq startup in Android virtual device, repl should be able to connect
  • For browser console print and devtool remote debug, open chrome, type url chrome://inspect/#devices, you should see your device there, click inspect

Build a release and install it to your android device

  • Comment in server url in capacitor.config.ts.
  • Connect your device to PC.
  • Run yarn clean && yarn release-app && rm -rf ./public/static && rm -rf ./static/js/*.map && mv static ./public && npx cap sync android && npx cap run android

Build a apk

  • Comment out server url in capacitor.config.ts.
  • Run yarn clean && yarn release-app && rm -rf ./public/static && rm -rf ./static/js/*.map && mv static ./public && npx cap sync android.
  • In Android Studio, open Build -> Build Bundles / APKs -> Build APKs.
  • Get your apk in android/app/build/apk/debug.

[^1] https://developer.android.com/studio/index.html

[^2] https://capacitorjs.com/docs/getting-started/environment-setup

Develop without opening Android Studio

  1. brew install gradle
  2. make sure java version using 11
  3. cd web/android && gradle wrapper
  4. install android sdk 30