bpevs / tauri_deno_mobile_sample

Sample app using the Tauri Mobile Alpha version with a Deno app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tauri Deno Mobile (Android) Sample

Building on MacOS I only made this work with Android so far...

Heavy inspiration from Tauri Deno Starter!

Now you, too, can create fake native deno phone apps

Environment Setup

Assuming you have already installed latest Deno and Rust...

Install full xcode (Maybe optional?)

I had to install this to run cargo mobile and cargo android, which I mistakenly used first. So maybe cargo tauri android gets around this? I haven't uninstalled it, so not sure if it's actually necessary.

When I was running cargo mobile, it made me use the full xcode instead of xcode-select, because it was trying to build for iOS. So maybe that is required as well, not sure.

Install Tauri Alpha Version (with Mobile)

Just followed cargo add stuff from the tauri blog post, ignoring the npm stuff.

Android Stuff

Basically, I followed the Alpha Docs

Downloaded Android Studio...

The download for NDK was in: Android Studio > Tools > SDK Manager > Android SDK > SDK TOOLS

I installed:

  • Android SDK Build-TOols
  • NDK (Side by side)
  • Android Emulator
  • Android SDK Platform-Tools

Then found NDK version via ls $HOME/Library/Android/sdk/ndk

My env variables ended up looking like this:

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export NDK_HOME="$ANDROID_HOME/ndk/25.1.8937393"

Project Setup

How we got the repo to this point...

  • build /gen dir: cargo tauri init (recc to delete, rebuild after updating Carto.toml and tauri.conf.json with your app identifiers)
    • points to ../src/www
    • beforeDevCommand: deno run -A scripts/main.ts dev
    • beforeBuildCommand: deno run -A scripts/main.ts build
    • host: http://localhost:3000
  • Added Deno Files
    • scripts/main.ts: build script, using esbuild
  • Prevent screen rotation by modifying /gen/android/app/app/src/main/AndroidManifest.xml:
    • adds android:screenOrientation

Usage

Desktop

  • tauri run dev
  • tauri run build

Android

  • tauri run android init
  • tauri run android dev
  • tauri run android build --debug (need to sign app for release build to work)

About

Sample app using the Tauri Mobile Alpha version with a Deno app


Languages

Language:Kotlin 56.5%Language:TypeScript 21.6%Language:Rust 17.2%Language:HTML 4.8%