Whenever i run the flutter run -v i get error in aapt dump xmltree. so now i separately run the aapt dump command so i get the erro in AndroidManifest.xml which is not able to open.
Coomand
C:\Users\admin\AppData\Local\Android\Sdk\build-tools\28.0.3>aapt dump C:\Users\admin\AndroidStudioProjects\flutter_app\build\app\outputs\apk\app.apk AndroidManifest.xml
Output
Binary APK
Package name=com.example.flutter_app id=7f
type drawable id=01 entryCount=1
resource 0x7f010000 drawable/launch_background
() (file) res/drawable/launch_background.xml type=XML
type mipmap id=02 entryCount=1
resource 0x7f020000 mipmap/ic_launcher
(mdpi) (file) res/mipmap-mdpi-v4/ic_launcher.png type=PNG
(hdpi) (file) res/mipmap-hdpi-v4/ic_launcher.png type=PNG
(xhdpi) (file) res/mipmap-xhdpi-v4/ic_launcher.png type=PNG
(xxhdpi) (file) res/mipmap-xxhdpi-v4/ic_launcher.png type=PNG
(xxxhdpi) (file) res/mipmap-xxxhdpi-v4/ic_launcher.png type=PNG
type style id=03 entryCount=1
resource 0x7f030000 style/LaunchTheme
() (style) size=1 parent=0x01030009
0x01010054=#drawable/launch_background
W/ziparchive( 5152): Unable to open 'AndroidManifest.xml': No such file or directory
AndroidManifest.xml: error: failed to open file: The system cannot find the file specified. (2).
Related
I'm attempting to build an android project's data without using gradle for educational, portability and efficiency reasons (both in running the build and setting it up). My project doesn't require the heavyweight build processes in gradle as it's 99% a C++ project built with make. I also wish to understand the underlying processes better and I find gradle hides these.
I'm using AAPT (should I be using AAPT2?) and need to include an existing library's resources. I've learned that I need to use '-S' for these and I've been experimenting with the ordering of those parameters - each order gives different errors.
My batch file (I'm working on Windows ATM) currently looks like this:
echo off
set PROJ_DIR=%cd%
set BUILDTOOLSDIR=%ANDROID_SDK_ROOT%\build-tools\32.0.0
echo PROJ_DIR is %PROJ_DIR%
echo BUILD_TOOLS_DIR is %BUILDTOOLSDIR%
echo on
%BUILDTOOLSDIR%\aapt.exe package --non-constant-id -m -f ^
-M %PROJ_DIR%\AndroidManifest.xml ^
-I %ANDROID_SDK_ROOT%\platforms\android-32\android.jar ^
-P %PROJ_DIR%\libs\android-support-v7-appcompat.jar ^
-S C:\prog\libs\android\android-support-v7-appcompat\res\
-S %PROJ_DIR%\res ^
-J %PROJ_DIR%\src ^
--generate-dependencies ^
--auto-add-overlay
And I'm getting the following errors:
android-build\AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'icon' with value '#mipmap/ic_launcher').
android-build\AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'label' with value '#string/app_name').
android-build\AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'roundIcon' with value '#mipmap/ic_launcher_round').
android-build\AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'theme' with value '#style/AppTheme').
Those resources appear to exist, although I'm not sure how AAPT selects between the various resolution and shape variants I have. My 'res' directory looks like this:
drawable
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-v24
layout
mipmap-anydpi-v26
mipmap-hdpi
mipmap-mdpi
mipmap-xhdpi
mipmap-xxhdpi
mipmap-xxxhdpi
values
If I swap the order of the '-S' directories (I gather one of them is considered 'primary' and others 'overlays'), I get the following errors:
\res\values\styles.xml:8: error: Error: No resource found that matches the given name: attr 'colorAccent'.
\res\values\styles.xml:6: error: Error: No resource found that matches the given name: attr 'colorPrimary'.
\res\values\styles.xml:7: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
\res\values\styles.xml:10: error: Error: No resource found that matches the given name: attr 'windowNoTitle'.
However, all of those colour definitions are present in '\res\values\color.xml'
These errors caused me to swap the -S directories around to an order I thought was probably incorrect in the first place, which removed the colour errors but produced the icon errors.
My question is why are these linking errors occurring when the files all appear to be in place? Are there any more general tips for hand-coding calls to AAPT (or AAPT2) or obvious mistakes I'm making in my AAPT call?
%BUILDTOOLSDIR%\aapt.exe package -f ^
-M %PROJ_DIR%\AndroidManifest.xml ^
-S %PROJ_DIR%\res ^
-S C:\prog\libs\android\android-support-v7-appcompat\res\ ^
-I %ANDROID_CP% ^
-I %ANDROID_SDK_ROOT%\platforms\android-32\android.jar ^
-S %PROJ_DIR%\res ^
-J %PROJ_DIR%\src ^
-F %APK_BASENAME%.apk.unaligned ^
--generate-dependencies ^
--auto-add-overlay
In the end, this worked and I removed references to the colour themes as I wasn't using them anyway. APK still doesn't run correctly (cannot find a class that is clearly right there) but it's dalvikified, aligned, signed and on the device.
I am trying to run a command via aapt to test out the functionality.
./aapt package -f --no-crunch
-M /home/username/AndroidStudioProjects/ProjectName/androidTest/src/main/AndroidManifest.xml
-I /home/username/Android/Sdk/platforms/android-27/android.jar
-S /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/
But I get this weird error message.
invalid resource directory name: /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/ drawable-xhdpi-v4_abc_list_selector_disabled_holo_dark.9.png.flat
invalid resource directory name: /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/ drawable_abc_ic_go_search_api_material.xml.flat
invalid resource directory name: /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/ drawable-xxxhdpi-v4_abc_scrubber_control_to_pressed_mtrl_005.png.flat
invalid resource directory name: /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/ color_abc_primary_text_material_light.xml.flat
invalid resource directory name: /home/username/AndroidStudioProjects/ProjectName/androidTest/build/intermediates/res/merged/androidTest/debug/ drawable-mdpi-v4_abc_btn_check_to_on_mtrl_000.png.flat
ERROR: Invalid BCP 47 tag in directory name b+sr+latn_values
And so forth like this.
I am using Gradle 3.0.1 to build the project. What causes this error ?
Gradle 3.0.1 doesn't uses aapt it uses aapt2 by default. The build process is different for both of these.More details in this link.
aapt2 can be disabled my adding android.enableAapt2=false in gradle.properties file.
I'm having some issues with Google Play Services and Unity 5.0.4.
The issue occurs when I want to build my build my project, I get the following error
CommandInvokationFailure: Failed to re-package resources.
I've read a lot and tried to fix it, but no solution been working for me.
I've got the latest Google Play serivces (Rev 32), Google Repository (Rev 32) and Android Support Repository (Rev 35).
I've also read that you can't have API 24 installed, so I've uninstalled and removed it completely. I can't find any other solution to my problem.
Whole console log:
CommandInvokationFailure: Failed to re-package resources.
C:\Android\android-sdk\build-tools\23.0.3\aapt.exe package
--auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Android/android-sdk\platforms\android-23\android.jar" -F
bin/resources.ap_ --extra-packages
com.google.example.games.mainlibproj stderr[ AndroidManifest.xml:19:
error: Error: No resource found that matches the given name (at
'value' with value '#integer/google_play_services_version'). ]
stdout[ Configurations: (default) v14 v21 xhdpi-v4 Files:
drawable\app_banner.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png drawable\app_icon.png
Src: () res\drawable\app_icon.png values\strings.xml
Src: () res\values\strings.xml values\styles.xml
Src: () res\values\styles.xml
Src: (v14) res\values-v14\styles.xml
Src: (v21) res\values-v21\styles.xml AndroidManifest.xml
Src: () AndroidManifest.xml Resource Dirs: Type drawable
drawable\app_banner.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
drawable\app_icon.png
Src: () res\drawable\app_icon.png Type values
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v14) res\values-v14\styles.xml
Src: (v21) res\values-v21\styles.xml Including resources from package: C:\Android\android-sdk\platforms\android-23\android.jar
applyFileOverlay for drawable applyFileOverlay for layout
applyFileOverlay for anim applyFileOverlay for animator
applyFileOverlay for interpolator applyFileOverlay for transition
applyFileOverlay for xml applyFileOverlay for raw applyFileOverlay for
color applyFileOverlay for menu applyFileOverlay for mipmap Processing
image: res\drawable-xhdpi\app_banner.png Processing image:
res\drawable\app_icon.png
(processed image res\drawable\app_icon.png: 94% size of source)
(processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
(new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
(new resource id app_icon from drawable\app_icon.png #generated) ] UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo
psi, UnityEditor.Android.WaitingForProcessToExit
waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec
(System.String command, System.String args, System.String workingdir,
System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks
(UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()
There can be following possible problems:
There might be some duplicate jar files in your plugins folder. Find them and remove one of them to fix this problem.
There might be an issue with merging data from more than one manifest files.
Check following posts to get the pointer :
http://forum.unity3d.com/threads/commandinvokationfailure-android-asset-packaging-tool-failed-no-stderr-to-lookup.274631/
http://answers.unity3d.com/questions/1074000/unity-5-android-build-failed-to-re-package-resourc.html
https://github.com/playgameservices/play-games-plugin-for-unity/issues/900
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1011
Error building player for Android in Unity?
EDIT :
You are missing res folder in plugins.
Check this answer : https://stackoverflow.com/a/38076937/4366237
And this forum post : http://forum.unity3d.com/threads/help-cant-build-project-after-trying-to-use-google-play-services.243284/
i got a problem to build my android APK.
I've saw some question with the same error, but everything is about Google Play Services.
In my case i have the same error but with my own Plugin. The error i'ts from the Android Manifest.xml, and i need know how i can resolve it.
In some forums i'd see the solutions like; Update the building tools (i'm do it)
and add some lines to the AndroidManifest.xml....but these lines, are to Google Play Service...i must rewrite to my own Plugin.
Any idea?
I paste the error and another solutions for reference;
http://answers.unity3d.com/questions/834744/building-android-application-failed-re-package-res.html
ERROR OUTPUT:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\ppalma\AppData\Local\Android\sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/ppalma/AppData/Local/Android/sdk/platforms/android-23\android.jar" -F bin/resources.ap_
stderr[
AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at 'theme' with value '#style/Theme.Holo.Light.DarkActionBar').
]
stdout[
Configurations:
(default)
Files:
drawable\app_icon.png
Src: () res\drawable\app_icon.png
values\strings.xml
Src: () res\values\strings.xml
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Type drawable
drawable\app_icon.png
Src: () res\drawable\app_icon.png
Type values
values\strings.xml
Src: () res\values\strings.xml
Including resources from package: C:\Users\ppalma\AppData\Local\Android\sdk\platforms\android-23\android.jar
applyFileOverlay for drawable
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable\app_icon.png
(processed image res\drawable\app_icon.png: 90% size of source)
(new resource id app_icon from drawable\app_icon.png #generated)
]
I am getting this error when i try to build my game for android. But it successfully built to webplayer. i checked everything is right,
and one think recently i upgrade my unity to 4.5.1
Error details are:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\build-tools\android-4.4\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/adt-bundle-windows-x86_64-20131030/adt-bundle-windows-x86_64-20131030/sdk/platforms/android-18\android.jar" -F bin/resources.ap_
stderr[
AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version').
]
stdout[
Configurations:
(default)
hdpi
ldpi
xhdpi
xxhdpi
Files:
drawable\app_icon.png
Src: () res\drawable\app_icon.png
Src: (hdpi) res\drawable-hdpi\app_icon.png
Src: (ldpi) res\drawable-ldpi\app_icon.png
Src: (xhdpi) res\drawable-xhdpi\app_icon.png
Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png
values\strings.xml
Src: () res\values\strings.xml
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Type drawable
drawable\app_icon.png
Src: () res\drawable\app_icon.png
Src: (hdpi) res\drawable-hdpi\app_icon.png
Src: (ldpi) res\drawable-ldpi\app_icon.png
Src: (xhdpi) res\drawable-xhdpi\app_icon.png
Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png
Type values
values\strings.xml
Src: () res\values\strings.xml
Including resources from package: D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\platforms\android-18\android.jar
applyFileOverlay for drawable
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable-hdpi\app_icon.png
Processing image: res\drawable\app_icon.png
(processed image res\drawable\app_icon.png: 97% size of source)
Processing image: res\drawable-ldpi\app_icon.png
(processed image res\drawable-ldpi\app_icon.png: 98% size of source)
Processing image: res\drawable-xhdpi\app_icon.png
(processed image res\drawable-hdpi\app_icon.png: 98% size of source)
Processing image: res\drawable-xxhdpi\app_icon.png
(processed image res\drawable-xhdpi\app_icon.png: 98% size of source)
(processed image res\drawable-xxhdpi\app_icon.png: 98% size of source)
(new resource id app_icon from drawable\app_icon.png #generated)
(new resource id app_icon from hdpi\drawable\app_icon.png #generated)
(new resource id app_icon from ldpi\drawable\app_icon.png #generated)
(new resource id app_icon from xhdpi\drawable\app_icon.png #generated)
(new resource id app_icon from xxhdpi\drawable\app_icon.png #generated)
]
I deleted the 24.0.0 build tools folder from Android\sdk\build-tools and it's working !
You need to put the google_play_service_lib folder from the androidsdk\extra\google folder in plugins\android in order to make it work properly.
You can find it in android-sdk-windows\extras\google\google_play_services\libproject. There you will find google_play_service_lib. You copy it in plugins/android in unity
Credit to Ouss.
note: if it's already in there, then chances are you've updated the android sdk, so you need the new lib folder. Close out of unity > delete the google play services lib folder > go to you sdk folder listed above > copy the lib folder in the address above > go back to your android plugins folder in your unity app > paste it in there > reopen unity and allow the scripts to compile > build.
There is a new problem out there. In case you installed the Android preview SDK 24.0.0 (if you have such a folder inside the build tools folder) then unity does not build / repackage properly.
I see this issue:
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\android-sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.everyplay.Everyplay:com.google.example.games.mainlibproj:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.nearby:com.google.android.gms.plus:android.support.v4 -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\everyplay\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-base-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-basement-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-drive-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-games-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-nearby-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-plus-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\support-v4-23.1.1\res"
stderr[
]
stdout[
Configurations:
(default)
Files:
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Including resources from package: C:\android-sdk\platforms\android-23\android.jar
applyFileOverlay for drawable
trying overlaySet Key=ic_plusone_medium_off_client.png
trying overlaySet Key=ic_plusone_small_off_client.png
trying overlaySet Key=ic_plusone_standard_off_client.png
trying overlaySet Key=ic_plusone_tall_off_client.png
trying overlaySet Key=common_full_open_on_phone.png
trying overlaySet Key=common_google_signin_btn_icon_dark.xml
trying overlaySet Key=common_google_signin_btn_icon_dark_disabled.9.png
The only working solution I found is to uninstall the 24.0.0 build tools folder - means simply delete it and restart Unity. Seems that Unity has issues with the new Android 24 build tools.
Edit: you'll find the build tools folder inside your Android SDK Folder
What i did and it worked.
i had only jre not jdk. First i download jdk from oracle site.
set up environments path:
JAVA_HOME
C:\Program Files (x86)\Java\jdk1.8.0_11\bin
but error exist again.
========================================
Then i got this guide:
try this and tell if it works.
copy zipalign.exe file from > D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W
or where ever you have it and then Past to > D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools
Unity3diy forums
And everything works perfect :)