You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I tried to use the cargo mobile2 with egui template, and it failed to build. It seems it tries to use aapt2 from build tools 30.0.3 which is old and does not support --source-path flag. If I remove the version 30.0.3 and only install 34.0.0, it will try to install 30.0.3 and fails (since I manage my android sdk using nix and it is read only).
Steps To Reproduce
Create a new cargo mobile project with cargo mobile init using template egui
Run cargo android apk build and see it fails.
If you want to reproduce my dev environment exactly, here is my nix shell config:
{pkgs?import<nixpkgs>{}}:
withpkgs;letandroidComposition=androidenv.composeAndroidPackages{buildToolsVersions=["34.0.0""30.0.3"];platformVersions=["16""28""33""34"];includeSystemImages=false;systemImageTypes=["default"];abiVersions=["x86""x86_64""armeabi-v7a""arm64-v8a"];includeNDK=true;ndkVersions=["25.2.9519653"];includeExtras=[];};androidsdk=androidComposition.androidsdk;sdk_root="${androidsdk}/libexec/android-sdk";ndk_root="${sdk_root}/ndk-bundle";ndk_path="${ndk_root}/toolchains/llvm/prebuilt/linux-x86_64/bin";inmkShellrec{ANDROID_NDK_ROOT="${ndk_root}";NDK_HOME="${ndk_root}";ANDROID_HOME="${sdk_root}";# llvm-config for libclang##PATH = "${ndk_path}:${builtins.getEnv "PATH"}";shellHook='' buildToolsVersion=$(ls -1 ${sdk_root}/build-tools | head -n1) export GRADLE_OPTS="-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdk_root}/build-tools/$buildToolsVersion/aapt2" export PATH="${ndk_path}:${androidsdk}/bin:$PATH"; '';buildInputs=[pkg-configopensslzlibncurses5cmakelibssh2libgit2];}
Copy it into default.nix and run nix-shell.
Expected behavior
It should generate an apk, but fails with error.
Screenshots
Here is the full text of the error:
Building universal APK for aarch64, armv7, i686, x86_64 ...
WARNING: The option setting 'android.aapt2FromMavenOverride=/nix/store/i0p56rfzbi2y5zcpfr55d9rklra4spld-androidsdk/libexec/android-sdk/build-tools/30.0.3/aapt2' is experimental.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processUniversalDebugResources'.
> Could not resolve all files for configuration ':app:universalDebugRuntimeClasspath'.
> Failed to transform appcompat-1.5.0.aar (androidx.appcompat:appcompat:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: /home/codespace/.gradle/caches/transforms-4/865487115e386376af8042e87bb5e747/transformed/appcompat-1.5.0.
> Android resource compilation failed
ERROR: AAPT: unknown option '--source-path'.
aapt2 compile [options] -o arg files...
Options:
-o arg Output path
--dir arg Directory to scan for resources
--zip arg Zip file containing the res directory to scan for resources
--output-text-symbols arg Generates a text file containing the resource symbols in the
specified file
--pseudo-localize Generate resources for pseudo-locales (en-XA and ar-XB)
--no-crunch Disables PNG processing
--legacy Treat errors that used to be valid in AAPT as warnings
--preserve-visibility-of-styleables If specified, apply the same visibility rules for
styleables as are used for all other resources.
Otherwise, all stylesables will be made public.
--visibility arg Sets the visibility of the compiled resources to the specified
level. Accepted levels: public, private, default
-v Enables verbose logging
--trace-folder arg Generate systrace json trace fragment to specified folder.
-h Displays this help menu
> Failed to transform core-1.8.0.aar (androidx.core:core:1.8.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: /home/codespace/.gradle/caches/transforms-4/4954e45e28b388d768bd89053e7a917e/transformed/core-1.8.0.
> Android resource compilation failed
ERROR: AAPT: unknown option '--source-path'.
aapt2 compile [options] -o arg files...
Options:
-o arg Output path
--dir arg Directory to scan for resources
--zip arg Zip file containing the res directory to scan for resources
--output-text-symbols arg Generates a text file containing the resource symbols in the
specified file
--pseudo-localize Generate resources for pseudo-locales (en-XA and ar-XB)
--no-crunch Disables PNG processing
--legacy Treat errors that used to be valid in AAPT as warnings
--preserve-visibility-of-styleables If specified, apply the same visibility rules for
styleables as are used for all other resources.
Otherwise, all stylesables will be made public.
--visibility arg Sets the visibility of the compiled resources to the specified
level. Accepted levels: public, private, default
-v Enables verbose logging
--trace-folder arg Generate systrace json trace fragment to specified folder.
-h Displays this help menu
> Failed to transform core-1.8.0.aar (androidx.core:core:1.8.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /home/codespace/.gradle/caches/transforms-4/4954e45e28b388d768bd89053e7a917e/transformed/core-1.8.0.
> Android resource compilation failed
ERROR: AAPT: unknown option '--source-path'.
aapt2 compile [options] -o arg files...
Options:
-o arg Output path
--dir arg Directory to scan for resources
--zip arg Zip file containing the res directory to scan for resources
--output-text-symbols arg Generates a text file containing the resource symbols in the
specified file
--pseudo-localize Generate resources for pseudo-locales (en-XA and ar-XB)
--no-crunch Disables PNG processing
--legacy Treat errors that used to be valid in AAPT as warnings
--preserve-visibility-of-styleables If specified, apply the same visibility rules for
styleables as are used for all other resources.
Otherwise, all stylesables will be made public.
--visibility arg Sets the visibility of the compiled resources to the specified
level. Accepted levels: public, private, default
-v Enables verbose logging
--trace-folder arg Generate systrace json trace fragment to specified folder.
-h Displays this help menu
* 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.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 1s
error: Failed to assemble APK
command ["/workspaces/codespaces-blank/gen/android/gradlew", "--project-dir", "/workspaces/codespaces-blank/gen/
android"] exited with code 1
Platform and Versions (please complete the following information):
Host OS: Linux ubuntu 20.04
Target OS: Android
Rustc: 1.80
Ouput of cargo mobile doctor:
✔] cargo-mobile v0.13.5
• Contains commits up to "publish new versions (#369)\n"
• Installed at "~/.cargo/.cargo-mobile2"
• Ubuntu v20.04.6 LTS (Focal Fossa
• rustc v1.80.1 (3f5fd8dd4 2024-8-6)
[✔] Android developer tools
• SDK v26.1.1 installed at "/nix/store/i0p56rfzbi2y5zcpfr55d9rklra4spld-androidsdk/libexec/android-sdk"
• NDK v25.2.9519653 installed at "/nix/store/i0p56rfzbi2y5zcpfr55d9rklra4spld-androidsdk/libexec/android-sdk/
ndk-bundle"
[✔] Connected devices
• No connected devices were found
Additional context
It's probably more a problem of me and my config since I'm new to rust android dev, so thanks in advance for the time you put on helping me.
The text was updated successfully, but these errors were encountered:
Describe the bug
I tried to use the
cargo mobile2
withegui
template, and it failed to build. It seems it tries to useaapt2
from build tools30.0.3
which is old and does not support--source-path
flag. If I remove the version30.0.3
and only install34.0.0
, it will try to install 30.0.3 and fails (since I manage my android sdk using nix and it is read only).Steps To Reproduce
cargo mobile init
using templateegui
cargo android apk build
and see it fails.If you want to reproduce my dev environment exactly, here is my nix shell config:
Copy it into
default.nix
and runnix-shell
.Expected behavior
It should generate an
apk
, but fails with error.Screenshots
Here is the full text of the error:
Platform and Versions (please complete the following information):
Host OS: Linux ubuntu 20.04
Target OS: Android
Rustc: 1.80
Ouput of
cargo mobile doctor
:Additional context
It's probably more a problem of me and my config since I'm new to rust android dev, so thanks in advance for the time you put on helping me.
The text was updated successfully, but these errors were encountered: