I am trying to run a Phonegap application but some images in the resources directory are preventing it from starting. when i delete the images files from my project it works just fine.
Execution failed for task ':mergeDebugResources'.
Error: Failed to run command:
/Users/macbookpro/Library/Android/sdk/build-tools/22.0.1/aapt s -i ../platforms/android/res/drawable-land-xhdpi/screen.9.png -o ../platforms/android/build/intermediates/res/debug/drawable-land-xhdpi-v4/screen.9.png
Output: ERROR: 9-patch image ../platforms/android/res/drawable-land-xhdpi/screen.9.png malformed.
No marked region found along edge.
Found along top edge.
First remove all your splash.png files and clean your cordova project by using this command ./platforms/android/cordova/clean
then copy the splash.9.png files in your res folders
then build the project, that worked for me.
You can make .9.png files with the help of this online tool
Related
I am trying to create an APK extension file (.obb) bigger than 2 GB. Yes, I know that in Play Store exists that limitation, BUT in Oculus Store files up to 4 GB are allow.
However, when I try to create the "big" extension file (Using Unity 2017.1.0p5 and (Split Application Binary), the console shows the following Android error:
CommandInvokationFailure: Android Asset Packaging Tool failed.
C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\aapt.exe package -v -f -F rawobb.ap_ -A rawobb -0 "" --ignore-assets "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
stderr[ Unable to add 'rawobb\MenuMusic.tbe': Zip add failed (-2147483648)
ERROR: unable to process assets while packaging 'rawobb.ap_'
ERROR: packaging of 'rawobb.ap_' failed
]
stdout[
Found 5 custom asset files in rawobb
Configurations:
(default)
Please, I would like to know how I could use aapt (and its zipping) to allow create such a big files, and then I was wondering about create perhaps a gradle task in Unity with that command.
Or if you know some other way of creating a big obb and that Unity could read it (I would like to avoid hosting files in other servers).
Many thanks!
For a college course, I am required to use a Google Drive folder as my project location. The problem is that Google Drive makes my hidden OS X Icon files appear.
When I try running the app within Android Studio, and it gets built, an Icon file opens and I get the following messages:
Files under the build folder are generated and should not be edited.
Error: The file name must end in .xml.
My res/layout folder contains an Icon file, which (obviously) does not end in .xml. I deleted the file, but I still get the same error.
Is there a way to work around this issue to build my app in a Google Drive folder on a Mac, or is it not possible?
Here are the errors in context:
/Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable/Icon
Error:Error: The file name must end with .xml
:app:preBuild UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:prepareDebugDependencies
:app:generateDebugBuildConfig UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
Error:Error: The file name must end with .xml
:app:generateDebugResources UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
Error:Error: The file name must end with .xml
/Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/color-v23/Icon
Error:Error: The file name must end with .xml or .png
/Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-hdpi-v4/Icon
Error:Error: The file name must end with .xml or .png
/Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-hdpi-v17/Icon
Error:Error: The file name must end with .xml or .png
/Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-mdpi-v17/Icon
Error:Error: The file name must end with .xml or .png
These are the solutions we developed, based on Hod's answer.
Getting rid of all current Icon files
Open a terminal window in the parent folder to your projects.
To look for Icon files, execute: find . -name Icon\*
If you get any results, execute: find . -name Icon\* -delete
Automatically removing future Icon files
Open a terminal window in the parent folder to your projects.
Copy and paste in this incantation ( (adapted from https://stackoverflow.com/a/9625233/631051), which will delete Icon files every minute:
(crontab -l 2>/dev/null; echo "*/1 * * * * find . -name Icon\* -delete") | crontab -
To undo, enter the following incantation (adapted from https://askubuntu.com/a/719877/43296) in a terminal window (in any folder):
crontab -l | grep -v Icon | crontab -
Assumptions
All of this assumes that you have:
no files whose names start with Icon in your projects hierarchy that you want to keep.
no cron jobs involving Icon that you want to keep.
This is happening because you've set the icon for the folder to something besides the default. Here's an example where I've changed only the drawables icon:
Setting a custom icon is what creates the Icon file. (It's normally hidden in Finder.)
To fix this, the easiest thing would be to reset the icon back to the default. To do that, in Finder, right click on the folder and select "Get Info". This will bring up the info window. Select the folder icon in the upper left by clicking on it, then in the top bar menu do Edit -> Cut. Here's an image to show the info window with the icon selected:
That should reset the icon and fix your problem.
Another approach is to clean out all the icons under a specific folder. On the command line, change directories to the top level folder. Then run find . -name Icon\* -delete. Note this will delete any file starting with the work Icon. To test what files will be deleted, you can first run find . -name Icon\* by itself to get a list.
It may be that an unknown application is updating the icons (see comments). The command line listed above can be used to clean up the icons on a regular basis.
Try excluding the files or directory or folder from being compiled. In your app build.gradle file try to exclude those files. You can try the check these links 1 2 3
Building the project throws the following
error:
Error:com.android.builder.internal.aapt.AaptException:
Failed to crunch file ....\common_google_signin_btn_text_dark_pressed.9.png into ....\common_google_signin_btn_text_dark_pressed.9.png
Error: File path too long on windows, keep below 240 characters
Just try to use shorter path for your project. In my case i have just moved my project folder to desktop and after opening project from desktop this problem will disappear automatically.
I have search all the possible available solution but still i am facing same issue with unclear error for me.
Now the complete error is-
AAPT err(Facade for 370671127): libpng error: Not a PNG file
Error:Execution failed for task ':app:mergeDebugResources'.
Some file crunching failed, see logs for details
Now from this line libpng error: Not a PNG file actual i am not getting where is the problem exist either in my any image files or anything else except this.
1- Before posting this issues i have changed my all the images existing in the diff-2 folders in required PNG formates as I see as solution in other post.
Note- Its working fine on eclipse now I am importing this in Android Studio.
Since during project build only single(above) error is shown so I guess there is not should be any other issue. I have spend more time to resolve this issues so all the suggestions are welcomes for me.
The problem is in your png files. Probably you images were optimized by some png optimization tools. Android tools use AAPT tool to optimize images during building your project. The reason for this problem is that AAPT tool doesn't know that you preprocessed the image.
To get around this in your application you need to specify the option in gradle
aaptOptions{
cruncherEnabled = false
}
This is disable AAPT optimization for all of your png files.
Similar question was asked here.
Although there can be various reasons for this error , i.e Can't resolve symbol R
But In particular, If the problem is saying Not a PNG file
My Case
For me ,it was a jpeg file that I had saved with extension .png which was the root cause
Solution
remove that jpeg image from your res/drawable folder
Note
renaming a jpeg to png doesn't mean it is a png in android studio... so get rid of that jpeg image
rebuild..
voila.. it works
hope it helps :)
Tricky little issue. A test project with FB plugin worked fine, my project gave me below error. Turns out when i connected FB test project to asset server, and the .meta files got created for each folder, it would barf also. Any way to tell compiler to skip .meta files?
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Users/me/android-sdk-macosx/platform-tools/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/me/android-sdk- macosx/platforms/android-17/android.jar" -F bin/resources.ap_ --extra-packages com.facebook.android -S "/Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res"
stderr[
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-hdpi.meta
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-ldpi.meta
invalid resource directory name: /Users/me/Unity/FBTest/Assets/Plugins/Android/facebook/res/drawable-mdpi.meta
UPDATE: can't seem to get rid of .meta files, even though i disconnected from asset server :( any ideas?
UPDATE: had to go Edit -> Project Settings -> Editor and disable version control to get this to compile. Would be nice if this could be fixed so meta files are ignored in the packageing of an APK...
May as well mark this as answered. The .meta files added for asset server are breaking the android packaging, so the work around is to disable source control under Edit -> Project Settings -> Editor before doing a build. Be nice if this was fixed so that step was unnecessary though...
UPDATE:
Um, reconnecting to asset server makes it think everything locally has changed, so this is a really, really sucky workaround
Found a stupid workaround because I was having the exact same problem, only tested on OSX since it relies on executing a python script via the hashbang line.
Go find the path where aapt is in your android SDK (android-sdk-macosx/build-tools/17.0.0/aapt for example) and rename it to aapt.real
Make a new file called aapt and put the following in it:
#!/usr/bin/env python
import os
import sys
os.execv(os.path.join(os.path.split(__file__)[0], 'aapt.real'), ['aapt'] + sys.argv[1:] + ['--ignore-assets', '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:!*.meta'])
Wonder why Unity doesn't include the --ignore-assets option to fix this problem.
i added the line
<property name="aapt.ignore.assets" value="!*.meta:!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" />
to the build.xml file of the facebook android unity sdk. no need to patch android sdk.
Another workaround that seems to work is to delete all the .meta files from the res folder after starting the build, but before unity starts the packaging process. Unity will not recreate the meta files while it is building the project. This way you don't have to disable and re-enable version control.