Monday, July 13, 2015

Android development in Windows, using Android Studio

Recently I have a try on Android Wear in the workshop, using the sample given from Google IO. I downloaded the sample and followed the instructions given.

As the official support on Eclipse ADT is going to end soon, I have to pick-up the new skill on the official Android Studio IDE. I was getting this error message after building it, saying:

Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\gan\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42

on this file:

C:\Users\gan\Desktop\gan\project\AndroidStudio\android-codelab-watchface-master\android-codelab-watchface-master\1-base\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\6.5.87\res\drawable-xhdpi\common_signin_btn_text_focus_light.9.png ERROR: Unable to open PNG file


However, other people using SDK version 21 ran fine without error. It is quite weird.
Some said it's SDK issue, some said it's gradle issue. I have tried few of them but no luck. I also thought it could be this "C:\Users\gan\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe" file having execution-right issue, but running it from command-line found no issue at all.


I was suggested by instructor, that it could be this image "common_signin_btn_text_focus_light.9.png" was the main culprit. So I was intended to replace with another dummy image. After finding a new dummy file and when I tried to replace it, I was getting another error message from Windows: "Destination Path Too Long"


That gave me the idea, it could be the Windows OS cannot handle the path which is too long, thus causing the the Android building process failed. By renaming to a shorter name, and it works!


1 comment:

John Frag said...

I recommend you to try Long Path Tool program to solve this problem