SOLVED--Error building Player: CommandInvokationFailure: Failed to build apk.

Any one!!!?? Ive searched for days for the answer but i cannot figure it out. Ive downloaded alllll referenced files and ive referenced them inside enviroment variables. I have sdk rev 21, and newest jdk as well as jdk 7. Ive tried Sdk rev 21 and 22. And jdk 32 and 64 bit versions. Ive referenced the, in prefrences inside unity. Ive done it all. This is the error.

Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details.
C:/Program Files/Java/jdk1.7.0_79\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“C:/Program Files (x86)/Android/android-sdk-windows\tools” -Dfile.encoding=UTF8 -jar “C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar” -

stderr[
Error: Not a file ’
‘C:\Users\shawnrevels\Documents\Vision’
]
stdout[

2 Likes

Solved, Moved a file from build tools to tools in sdk. and i forgot to add keystore file to developer settings.

1 Like

which file …?
plz reply as earlier as possible …really…stucked

‘zipalign.exe’ file, copy it from build tools folder to tools folder, and make sure you set up the keystore file in player settings.

This was driving me crazy. Thanks for the solution!!!

In my case I changed from JDK v9 to JDK v8 in Edit->Preferences…->External Tools (Android Section) and it works perfectly.

3253165--250527--Captura.PNG

15 Likes

This worked for me as well - downgrading from JDK9 to JDK8. Unity version 5.6. Jesus christ the hoops you have to jump through these days to get a simple Android build working.

9 Likes

Thank you very much! Build successfully after downgrading from JDK9 to JDK8. Unity 2017.01

2 Likes

I have the same problem … Couldn’t you please tell me should I delete the JDK-9.0.1 and download JDK 8u151?
… or something else must be done?

1 Like

Guys i don’t have any ‘zipalign.exe’ file here … as well as build tools folder, but I have downloaded from unity link … What can i do ?

I didn’t have a keystore, I didn’t move the zipalign.exe file. All I did was downgrading JDK 9.0 to JDK 8.0 and everything built properly. Thank you soydev!

When I changed java 9 to java8u151 , build successfully , thanks !!!

Thank you so much! This worked for me…changing to JDK v8 the updated version.

1 Like

I had this problem and this worked for me too! My first running android game! THANKS AGAIN!

You Are Great!

I love you.

i literally tried for two days, and it was just the JDK-8

-_-

i just failed to build afk file after downloading the whole jdk files nothink works
i quite before start

This solve the problem