-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b14114
commit 690d175
Showing
33 changed files
with
304 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
crates/scaffold-tauri-app/templates/executable-happ/Cargo.toml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{previous_file_content}} | ||
|
||
[patch.crates-io] | ||
# TODO: remove these patches once https://github.com/holochain/tx5/issues/87 is resolved | ||
tx5-go-pion-sys = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } | ||
tx5-go-pion-turn = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Developing for Android | ||
|
||
While developing a hApp, it's not that useful to just have one agent to test your hApp with. Instead, you usually need a couple of peers to be able to interact with one another. | ||
|
||
The scaffolding setup | ||
|
||
::: code-group | ||
```bash [npm] | ||
npm run android:network | ||
``` | ||
|
||
```bash [yarn] | ||
yarn android:network | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm android:network | ||
``` | ||
::: | ||
|
||
```bash | ||
adb devices | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# Android Setup | ||
|
||
> [!NOTE] | ||
> This guide assumes that you have already gone through either [how to create an executable hApp](./how-to-create-an-executable-happ.md) or [how to create a holochain runtime](./how-to-create-a-holochain-runtime.md). | ||
1. In the root folder of your repository, run: | ||
|
||
::: code-group | ||
```bash [npm] | ||
npm run tauri android init | ||
``` | ||
|
||
```bash [yarn] | ||
yarn tauri android init | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm tauri android init | ||
``` | ||
::: | ||
|
||
This should initialize all the necessary android files for your app. | ||
|
||
2. Go in the `src-tauri/gen/android/app/build.gradle.kts` that was generated in the previous step, and set the "usesCleartextTraffic" to true: | ||
|
||
```kotlin | ||
plugins { | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
id("rust") | ||
} | ||
|
||
android { | ||
compileSdk = 33 | ||
namespace = "com.tauri.tauri_app" | ||
defaultConfig { | ||
manifestPlaceholders["usesCleartextTraffic"] = "false" // [!code --] | ||
manifestPlaceholders["usesCleartextTraffic"] = "true" // [!code ++] | ||
applicationId = "com.tauri.tauri_app" | ||
minSdk = 24 | ||
targetSdk = 33 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
manifestPlaceholders["usesCleartextTraffic"] = "true" | ||
isDebuggable = true | ||
isJniDebuggable = true | ||
isMinifyEnabled = false | ||
packaging { | ||
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so") | ||
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so") | ||
jniLibs.keepDebugSymbols.add("*/x86/*.so") | ||
jniLibs.keepDebugSymbols.add("*/x86_64/*.so") | ||
} | ||
} | ||
getByName("release") { | ||
signingConfig = signingConfigs.getByName("release") | ||
isMinifyEnabled = true | ||
proguardFiles( | ||
*fileTree(".") { include("**/*.pro") } | ||
.plus(getDefaultProguardFile("proguard-android-optimize.txt")) | ||
.toList().toTypedArray() | ||
) | ||
} | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
|
||
rust { | ||
rootDirRel = "../../../" | ||
} | ||
|
||
dependencies { | ||
implementation("androidx.webkit:webkit:1.6.1") | ||
implementation("androidx.appcompat:appcompat:1.6.1") | ||
implementation("com.google.android.material:material:1.8.0") | ||
testImplementation("junit:junit:4.13.2") | ||
androidTestImplementation("androidx.test.ext:junit:1.1.4") | ||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") | ||
} | ||
|
||
apply(from = "tauri.build.gradle.kts") | ||
``` | ||
|
||
3. In your Android device, enable the [developer options](https://developer.android.com/studio/debug/dev-options). | ||
|
||
4. After you have enabled the developer options, [enable USB debbuging](https://developer.android.com/studio/debug/dev-options#Enable-debugging). | ||
|
||
5. Connect your Android device to your computer with a USB cable, and confirm in your Android device that you allow USB debugging from this computer. | ||
|
||
6. In the root folder of your repository, run: | ||
|
||
```bash | ||
nix develop .#androidDev | ||
``` | ||
|
||
This is a replacement command for the usual `nix develop`, which includes `Android Studio`, and all the necessary tooling that you need for Android development. Every time you want to test or build for the Android platform, you will need to enter the nix devShell this way and then your command from inside of it. | ||
|
||
> [!WARNING] | ||
> The first time this is run, it will take some time. This is because nix has to download and build all the necessary Android tooling. After the first time, it will be almost instant. | ||
7. Inside your `androidDev` devShell, run: | ||
|
||
```bash | ||
adb devices | ||
``` | ||
|
||
If all the previous steps were successful, you should see your device in the list of devices. | ||
|
||
8. Verify that everything is working by running the app for android with: | ||
|
||
::: code-group | ||
```bash [npm] | ||
npm run tauri android dev | ||
``` | ||
|
||
```bash [yarn] | ||
yarn tauri android dev | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm tauri android dev | ||
``` | ||
::: | ||
|
||
--- | ||
|
||
That's it! You have completed the setup for the Android platform. | ||
|
||
## Android Development | ||
|
||
### Developing | ||
|
||
::: code-group | ||
```bash [npm] | ||
npm run tauri android dev | ||
``` | ||
|
||
```bash [yarn] | ||
yarn tauri android dev | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm tauri android dev | ||
``` | ||
::: | ||
|
||
```bash | ||
adb devices | ||
``` | ||
|
||
### Publishing | ||
|
||
::: code-group | ||
```bash [npm] | ||
npm run tauri android build | ||
``` | ||
|
||
```bash [yarn] | ||
yarn tauri android build | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm tauri android build | ||
``` | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.