user987760
user987760

Reputation: 1081

Android Studio 2.2 Google play services sync Error

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

Upvotes: 22

Views: 13205

Answers (4)

Muhamed Riyas M
Muhamed Riyas M

Reputation: 5173

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

Upvotes: 1

jvlach
jvlach

Reputation: 565

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 {
       ...
    }
}

Upvotes: 25

Fabin Paul
Fabin Paul

Reputation: 1711

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).

Upvotes: 67

Uttam Panchasara
Uttam Panchasara

Reputation: 5865

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

Upvotes: -1

Related Questions