Have you installed the Android SDK? The `ANDROID_HOME` environment variable isn't set, and is required: environment variable not found: environment variable not found Error Have you installed the Android SDK? The `ANDROID_HOME` environment variable isn't set, and is required: environment variable not found: environment variable not found ELIFECYCLE Command failed with exit code 1.
Have you installed the NDK? The `NDK_HOME` environment variable isn't set, and is required: environment variable not found: environment variable not found Error Have you installed the NDK? The `NDK_HOME` environment variable isn't set, and is required: environment variable not found: environment variable not found ELIFECYCLE Command failed with exit code 1.
什么是NDK?
1 2 3 4
NDK(Native Development Kit)是安卓开发者工具集的一部分,允许你在安卓应用中编写原生代码(C或C++)。NDK主要用于以下几种情况: 性能关键的应用:对于需要高性能计算的任务,如图形处理、音频/视频编码解码、物理模拟等,使用C/C++可以提供更高效的执行。 复用现有的C/C++库:如果你已经有一个用C/C++编写的库,并希望在安卓应用中使用它,NDK可以帮助你将这些库集成到安卓项目中。 硬件访问:某些情况下,直接访问硬件特性(如传感器、相机等)可能需要使用NDK。
(!) Some chunks are larger than 500 kB after minification. Consider: - Using dynamic import() to code-split the application - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. ✓ built in 7.30s Downloaded android_system_properties v0.1.5 Downloaded android-tzdata v0.1.1 Downloaded cesu8 v1.1.0 Downloaded combine v4.6.7 Downloaded tao-macros v0.1.3 Downloaded linux-raw-sys v0.4.14 Downloaded proc-macro-crate v3.2.0 Downloaded iana-time-zone v0.1.61 Downloaded num_enum v0.7.3 Downloaded jni-sys v0.3.0 Downloaded is-wsl v0.4.0 Downloaded pathdiff v0.2.2 Downloaded num_enum_derive v0.7.3 Downloaded errno v0.3.9 Downloaded jni v0.21.1 Downloaded ndk-sys v0.6.0+11769913 Downloaded ndk v0.9.0 Downloaded signal-hook-registry v1.4.2 Downloaded rustix v0.38.40 Downloaded windows-targets v0.42.2 Downloaded is-docker v0.2.0 Downloaded ndk-context v0.1.1 Downloaded windows-sys v0.45.0 Downloaded 23 crates (5.6 MB) in 7.42s (largest was `windows-sys` at 2.6 MB) Compiling serde v1.0.215 Compiling libc v0.2.164 Compiling cfg-if v1.0.0 Compiling toml_edit v0.22.22 Compiling stable_deref_trait v1.2.0 Compiling smallvec v1.13.2 Compiling once_cell v1.20.2 Compiling zerofrom v0.1.4 Compiling itoa v1.0.11 Compiling memchr v2.7.4 Compiling writeable v0.5.5 Compiling siphasher v0.3.11 Compiling litemap v0.7.3 Compiling fnv v1.0.7 Compiling icu_locid_transform_data v1.5.0 Compiling log v0.4.22 Compiling icu_properties_data v1.5.0 Compiling percent-encoding v2.3.1 error[E0463]: can't find crate for `core` | = note: the `aarch64-linux-android` target may not be installed = help: consider downloading the target with `rustup target add aarch64-linux-android`
For more information about this error, try `rustc --explain E0463`. error: could not compile `cfg-if` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... error: could not compile `smallvec` (lib) due to 1 previous error error[E0463]: can't find crate for `std` | = note: the `aarch64-linux-android` target may not be installed = help: consider downloading the target with `rustup target add aarch64-linux-android`
error: could not compile `stable_deref_trait` (lib) due to 1 previous error error: could not compile `once_cell` (lib) due to 1 previous error error: could not compile `itoa` (lib) due to 1 previous error error: could not compile `zerofrom` (lib) due to 1 previous error error: could not compile `memchr` (lib) due to 1 previous error error: could not compile `writeable` (lib) due to 1 previous error error: could not compile `siphasher` (lib) due to 1 previous error error: could not compile `litemap` (lib) due to 1 previous error error: could not compile `fnv` (lib) due to 1 previous error error: could not compile `icu_locid_transform_data` (lib) due to 1 previous error error: could not compile `log` (lib) due to 1 previous error error: could not compile `icu_properties_data` (lib) due to 1 previous error error: could not compile `percent-encoding` (lib) due to 1 previous error error: could not compile `serde` (lib) due to 1 previous error `Failed to run `cargo build`: command ["cargo", "build", "--package", "project-graph", "--manifest-path", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\Cargo.toml", "--target", "aarch64-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls", "--lib", "--release"] exited with code 101 Error `Failed to run `cargo build`: command ["cargo", "build", "--package", "project-graph", "--manifest-path", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\Cargo.toml", "--target", "aarch64-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls", "--lib", "--release"] exited with code 101 ELIFECYCLE Command failed with exit code 1.
warning: `project-graph` (lib) generated 3 warnings (run `cargo fix --lib -p project-graph` to apply 2 suggestions) Finished `release` profile [optimized] target(s) in 1m 35s Info symlinking lib "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\target\\aarch64-linux-android\\release\\libproject_graph_lib.so" in jniLibs dir "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\app/src/main/jniLibs/arm64-v8a" Failed to create a symbolic link from "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\target\\aarch64-linux-android\\release\\libproject_graph_lib.so" to file "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\app/src/main/jniLibs/arm64-v8a\\libproject_graph_lib.so" (file clobbering enabled): Creation symbolic link is not allowed for this system.
For Windows 10 or newer: You should use developer mode. See https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
For Window 8.1 or older: You need `SeCreateSymbolicLinkPrivilege` security policy. See https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links Error Failed to create a symbolic link from "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\target\\aarch64-linux-android\\release\\libproject_graph_lib.so" to file "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\app/src/main/jniLibs/arm64-v8a\\libproject_graph_lib.so" (file clobbering enabled): Creation symbolic link is not allowed for this system.
For Windows 10 or newer: You should use developer mode. See https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
For Window 8.1 or older: You need `SeCreateSymbolicLinkPrivilege` security policy. See https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links ELIFECYCLE Command failed with exit code 1.
* What went wrong: A problem occurred configuring project ':buildSrc'. > Could not resolve all artifacts for configuration ':buildSrc:classpath'. > Could not resolve org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.4.0. Required by: project :buildSrc > org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.4.0 > Could not resolve org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.4.0. > Could not get resource 'https://plugins.gradle.org/m2/org/gradle/kotlin/gradle-kotlin-dsl-plugins/4.4.0/gradle-kotlin-dsl-plugins-4.4.0.pom'. > Could not GET 'https://plugins.gradle.org/m2/org/gradle/kotlin/gradle-kotlin-dsl-plugins/4.4.0/gradle-kotlin-dsl-plugins-4.4.0.pom'. > Read timed out
* 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.
BUILD FAILED in 7m 14s Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 Error Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 ELIFECYCLE Command failed with exit code 1.
Kotlin does not yet support 22 JDK target, falling back to Kotlin JVM_21 JVM target Kotlin does not yet support 22 JDK target, falling back to Kotlin JVM_21 JVM target w: Inconsistent JVM-target compatibility detected for tasks 'compileJava' (22) and 'compileKotlin' (21). This will become an error in Gradle 8.0. Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
* What went wrong: null cannot be cast to non-null type kotlin.String
* 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.
BUILD FAILED in 20m 2s Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 Error Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 ELIFECYCLE Command failed with exit code 1.
w: file:///D:/Rust/cargo_home/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.1.1/mobile/android/src/main/java/app/tauri/plugin/PluginMethodData.kt:11:23 Parameter 'methodDecorator' is never used error[E0463]: can't find crate for `core` |DLE = note: the `armv7-linux-androideabi` target may not be installed = help: consider downloading the target with `rustup target add armv7-linux-androideabi`
For more information about this error, try `rustc --explain E0463`. error: could not compile `cfg-if` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... error: could not compile `smallvec` (lib) due to 1 previous error error[E0463]: can't find crate for `std` |DLE = note: the `armv7-linux-androideabi` target may not be installed = help: consider downloading the target with `rustup target add armv7-linux-androideabi`
error: could not compile `stable_deref_trait` (lib) due to 1 previous error error: could not compile `once_cell` (lib) due to 1 previous error error: could not compile `zerofrom` (lib) due to 1 previous error error: could not compile `itoa` (lib) due to 1 previous error error: could not compile `writeable` (lib) due to 1 previous error error: could not compile `litemap` (lib) due to 1 previous error error: could not compile `memchr` (lib) due to 1 previous error error: could not compile `siphasher` (lib) due to 1 previous error error: could not compile `icu_locid_transform_data` (lib) due to 1 previous error error: could not compile `fnv` (lib) due to 1 previous error error: could not compile `log` (lib) due to 1 previous error error: could not compile `icu_properties_data` (lib) due to 1 previous error error: could not compile `write16` (lib) due to 1 previous error error: could not compile `percent-encoding` (lib) due to 1 previous error error: could not compile `libc` (lib) due to 1 previous error `Failed to run `cargo build`: command ["cargo", "build", "--package", "project-graph", "--manifest-path", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\Cargo.toml", "--target", "armv7-linux-androideabi", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib", "--release"] exited with code 101 Error `Failed to run `cargo build`: command ["cargo", "build", "--package", "project-graph", "--manifest-path", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\Cargo.toml", "--target", "armv7-linux-androideabi", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib", "--release"] exited with code 101 IDLE ?ELIFECYCLE? Command failed with exit code 1.
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:rustBuildArmRelease'. > Process 'command 'pnpm.cmd'' finished with non-zero exit value 1
* 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.
BUILD FAILED in 3m 20s Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 Error Failed to assemble APK: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1: command ["D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "D:\\Projects\\Project-Tools\\project-graph\\src-tauri\\gen/android"] exited with code 1 ELIFECYCLE Command failed with exit code 1.
原来还要再装一个
1
rustup target add armv7-linux-androideabi
这一步安装好像等待时间挺长,等了20分钟好像
装了一下发现还有 i686-linux-android
1
rustup target add i686-linux-android
还有
1
rustup target add x86_64-linux-android
好像没了
但又报错了
1 2 3
* What went wrong: Execution failed for task ':app:validateSigningUniversalRelease'. > Keystore file 'D:\Projects\Project-Tools\project-graph\src-tauri\gen\android\app\D:ProjectsProject-Toolsproject-graphkeystore.jks' not found for signing config 'release'.