Error: Could not expand ZIP *.aar

Hello, I’ve received message trying to run my app in Android Studio. Hierarchy looks like -Project

–MyProjectCore

—build.gradle

–MyProjectMain

—build.gradle

– build.gradle

– setting.gradle

Error: Execution failed for task ‘:MyProject:prepareMyProjectCoreUnspecifiedLibrary’. > Could not expand ZIP ‘/home/user/workspace/MyProject/MyProjectCore/build/libs/MyProjectCore.aar’.

But after rebuild it works until next run and I need to rebuild project once again (sometimes i’ve spent about 20 minutes for each rebuild).

build.gradle is typical file for android project, but in dependencies I compile Core project (which is library) dependencies {

compile project(’:MyProjectCore’) }

settings.gradle: include ‘:MyProjectCore’ include ‘:MyProject’

Threre is interesting things: this all used to work, but once day it throws this error. So I don’t know what to do

I use default-wrapper - http://services.gradle.org/distributions/gradle-1.9-all.zip

Could you run with --stacktrace and provide the full stacktrace of the error?

I’m sorry, but it was noisy exception, so I deleted project and re-created in another folder and it fixed this problem( So I hope another person who will have the same problem will write full error

Here is the stacktrace: http://pastebin.com/ECMcutkp

All symptoms were the same with me. It worked for a long time, then it started doing this, for no apparent reason. Rebuild fixed it for a while, then after few minor code changes, error…

If you look at the end of the trace, it’s complaining about filesystem permissions on a file.

What are the permissions of that file?

libGoogleAnalyticsServices.jar -> -r-xr-xr-x

if that’s what you are asking for :slight_smile: I can try to change it manually to something different if that would help.

Did you get that after extracting it from ‘/Users/daemontus/AndroidProjects/VideoOnTextureTestProject/VideoOnTextureTest/build/exploded-bundles/VideoOnTextureTestProjectLibrariesVuforiaUnspecified.aar’ ?

There is no AAR archive in the build/exploded-bundles folder. There is just a folder named VideoOnTextureTestProjectLibrariesVuforiaUnspecified.aar. So I took the permissions of the file inside that folder. If you tell me where I can find the original AAR archive, I can tell you if the permissions are the same.

We might have to take this to the adt-dev list as it looks specific to the Android plugin. Would you mind raising this there?

Ok, thanks for help :slight_smile:

So, fingers crossed, have to test it a bit more, but I probably managed to fix it!

Problem was not the .aar archive, nor the .jar in it. The problem was the original jar file in the libs folder of my project. For some reason, no one could write into it (-r-xr-xr-x). I changed the permissions so that everyone can change it (-rwxrwxrwx) and voila, it seems to work.

Although I’m not sure why would gradle need to write into the jarfile, niether I can tell why rebuild always fixed it for a while, at least it works.

Thank you again for your help :slight_smile: