Error: Could not expand ZIP *.aar


(andreys) #1

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


(Luke Daley) #2

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


(andreys) #3

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


(Samuel Pastva) #4

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…


(Luke Daley) #5

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?


(Samuel Pastva) #6

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.


(Luke Daley) #7

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


(Samuel Pastva) #8

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.


(Luke Daley) #9

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?


(Samuel Pastva) #10

Ok, thanks for help :slight_smile:


(Samuel Pastva) #11

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: