I’m trying out this tauri-mobile thing for building android apps. Pretty close to compiling, except for license problems in the link step.
I have a flake.nix file. Just for setting up a dev environment for now.
I’m using nixpkgs.androidenv to set up my android stuff. I’m able to cargo tauri android init
, and then cargo tauri android build
, but it fails with:
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportUniversalRelease'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-33 Android SDK Platform 33
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
I tried adding all the ‘extraLicenses’ in /nixpkgs/pkgs/development/mobile/androidenv/repo.json. I’ve also got this stuff in my nixpkgs:
pkgs = import nixpkgs {
config.android_sdk.accept_license = true;
config.allowUnfree = true;
system = "${system}"; };
And I even tried the android error message suggestion:
[bburdette@HOSS:~/code/zknotes/zknotes/tauri/src-tauri]$ sdkmanager --licenses
Warning: Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393')
Warning: Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393')
[=======================================] 100% Computing updates...
All SDK package licenses accepted.
Though I’m not really expecting that to work on nixos.
The full build log:
[bburdette@HOSS:~/code/zknotes/zknotes/tauri/src-tauri]$ cargo tauri android build
Info detected host target triple "x86_64-unknown-linux-gnu"
Compiling wry v0.24.3
Compiling tauri-runtime-wry v0.13.0
Compiling tauri v1.3.0
Compiling app v0.1.0 (/home/bburdette/code/zknotes/zknotes/tauri/src-tauri)
warning: function `main` is never used
--> tauri/src-tauri/src/mobile.rs:2:4
|
2 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `app` (lib) generated 1 warning
warning: function `greet` is never used
--> tauri/src-tauri/src/main.rs:24:4
|
24 | fn greet(name: &str) -> String {
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `app` (bin "app") generated 1 warning
Finished release [optimized] target(s) in 11.83s
Info symlinking lib "/home/bburdette/code/zknotes/zknotes/target/aarch64-linux-android/release/libapp.so" in jniLibs dir "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a"
Info "/home/bburdette/code/zknotes/zknotes/target/aarch64-linux-android/release/libapp.so" requires shared lib "libdl.so"
Info "/home/bburdette/code/zknotes/zknotes/target/aarch64-linux-android/release/libapp.so" requires shared lib "libc.so"
Info symlink at "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a/libapp.so" points to "/home/bburdette/code/zknotes/zknotes/target/aarch64-linux-android/release/libapp.so"
Observed package id 'build-tools;33.0.1' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/build-tools/33.0.1' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/build-tools/33.0.1')
Observed package id 'cmdline-tools;8.0' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/cmdline-tools/8.0' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/cmdline-tools/8.0')
Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/ndk/25.1.8937393')
Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/ndk/25.1.8937393')
Already observed package id 'ndk;25.1.8937393' in '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle'. Skipping duplicate at '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393'
Observed package id 'patcher;v4' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/patcher/v4' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/patcher/v4')
Observed package id 'platform-tools' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/platform-tools' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/platform-tools')
Observed package id 'tools' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/tools' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/tools')
Observed package id 'build-tools;33.0.1' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/build-tools/33.0.1' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/build-tools/33.0.1')
Observed package id 'cmdline-tools;8.0' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/cmdline-tools/8.0' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/cmdline-tools/8.0')
Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/ndk/25.1.8937393')
Observed package id 'ndk;25.1.8937393' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/ndk/25.1.8937393')
Already observed package id 'ndk;25.1.8937393' in '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk-bundle'. Skipping duplicate at '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/ndk/25.1.8937393'
Observed package id 'patcher;v4' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/patcher/v4' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/patcher/v4')
Observed package id 'platform-tools' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/platform-tools' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/platform-tools')
Observed package id 'tools' in inconsistent location '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/libexec/android-sdk/tools' (Expected '/nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/tools')
Checking the license for package Android SDK Build-Tools 30.0.3 in /nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/licenses
Warning: License for package Android SDK Build-Tools 30.0.3 not accepted.
Checking the license for package Android SDK Platform 33 in /nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk/licenses
Warning: License for package Android SDK Platform 33 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportUniversalRelease'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-33 Android SDK Platform 33
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
All licenses can be accepted using the sdkmanager command line tool:
sdkmanager.bat --licenses
Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle
Using Android SDK: /nix/store/mq9g7ppqc1hk0i3mzkh3bkibf1q276dq-androidsdk
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/8.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
Error Failed to assemble APK: command ["/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android"] exited with code 1: command ["/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android"] exited with code 1