Android Studio 2.2 Google play services sync Error
Asked Answered
A

4

22

I have update to android studio 2.2

I started a new project and i included

compile 'com.google.android.gms:play-services-vision:9.4.0+'

in my dependencies.

I am getting this Error when im launching the gradle sync.

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies] Error:com.android.builder.internal.aapt.AaptException: Failed to crunch file D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.4.0\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png into D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\res\merged\debug\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png Error:Execution failed for task ':app:mergeDebugResources'.

Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.4.0\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png into D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\res\merged\debug\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png Information:BUILD FAILED Information:Total time: 2.132 secs Information:2 errors Information:0 warnings Information:See complete output in console

Alonzoaloof answered 20/9, 2016 at 13:26 Comment(1)
I updated my machine to AS 2.2 and created a new project. I didn't get any error you cited. Try to move the project to a shorter path and update your Android SDK.Jaco
H
67

From what I understood, Failed to crunch file means studio can't process the file. This error usually occurs when you hit Maximum File Path Length Limitation(240 characters) of Windows OS.

I would suggest moving your project into upper directory (like D:\barcode-reader).

Holst answered 21/9, 2016 at 9:23 Comment(5)
Glad I could help..:)Holst
thanks it solve the problem by just renaming current directory but i don't understand why they put limit.Katrinka
I think this limit was introduced in DOS days... When you renamed the current directory say from "barcode-reader" to "br" number of character in the file path reduces. In your case, I have to assume,renaming the current directory reduced the path to less than 240 characters..Holst
Great! Solved my problem, I don't understand why is there still 240 chars limit.Pleione
Seems strange that we still have this limit. Seems like something that should have gone away circa Windows 2000...Protect
S
25

The problem is indeed the long file path. However, instead of moving your project, you could change the build directory for your project. This should solve the issue. In your root build.gradle add:

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    repositories {
       ...
    }
}
Stentorian answered 28/9, 2016 at 8:27 Comment(3)
Thank you. This seems to be a better solution.Charybdis
This definitely seems like a better approach but when building the SDK seems to complain about not finding certain files for its style (specifically values-v23.xml). I'm working on a Cocos2d-x project at the moment and the error I get is: Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.Interlineate
Can't edit my own comment... The solution to my problem was to up the target and compile SDK to version 23 on all of the sub projects. Upping the build tools version to 23.0.2 also helped.Interlineate
S
1

Just reduce your file path length, Reduce to maximum 240 characters.

Stake answered 12/1, 2017 at 13:37 Comment(0)
R
-1

try by adding like this ..

compile 'com.google.android.gms:play-services-vision:9.4.0'

And in Android Studio 2.2 it will automatically add the dependence just select it from 'Assistant' then select service that you want in project and Connect to Firebase

enter image description here

Retention answered 20/9, 2016 at 13:38 Comment(7)
i didn't work, im still getting the same error aboveAlonzoaloof
what is your gradle version ??Retention
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip classpath 'com.android.tools.build:gradle:2.2.0'Alonzoaloof
have you added this classpath 'com.google.gms:google-services:3.0.0' if not then addRetention
I did, it's all added hereAlonzoaloof
I tried it on my other laptop where i didn't yet upgrade, it works fine, just when i updated to 2.2 today , im having this issueAlonzoaloof
@Alonzoaloof did find any solution..?Showery

© 2022 - 2024 — McMap. All rights reserved.