Tuesday, May 15, 2018

CommandInvokationFailure: While Compiling for Android

While compiling for Android I got the following error:

CommandInvokationFailure: Failed to build apk. See the Console for details.
C:\Program Files\Java\jdk-10.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar"


Solution:

Use Java JDK 8. 

It seems that Unity 5.3.8 doesn't like JDK 9 or higher.
Downloaded 
jdk-8u171-windows-x64 from Oracle and install it.

Then in Unity under Edit > Preferences > External Tools point Unity to JDK 8.


Android SDK is outdated

I finished making the make screens for the game and it runs well when compiled for PC. Ultimately I want the game to run on Android and iOS so I thought I'd compile an APK file and try and get it running on my Samsung S6.

After following the instructions I found here: Building your Unity game to an Android device for testing

I installed Java JDK and Android Studio and pointed Unity to the tools directory that contains the Android SDK.


The Problem


However when I compiled for Android I kept getting the following messages:

"Android SDK is outdated" and "sdk tools version 23 < 24".

Unity then asked me if I wanted to update and after replying "yes" it went off, looped around a bit and then came back with same messages.



The Solution


All that was needed was for Unity to be running in Administrator mode.
Once in Administrator mode Unity managed to download what it needed and continue compiling.

So I decided that I want to make a game in Unity 3D


A Brief Prologue

I've been thinking about this game for about a year now and I've dabbled with Unity 3D on and off over a couple of years. A few years ago I started a Udemy course in Unity which I found pretty good. I only completed the 2D section which I think is all I need to make this game. Link: Complete C# Unity Developer 2D - Learn to Code Making Games

I have a background in programming and graphic design and I've worked a few years in the gaming industry so I'm hoping I know what I'm getting myself and I'm not going to bite off more than I can chew, which is often the case with wanna be game developers.

Anyway I'm not going to go into any detail about what this game is about as that is not the purpose of the blog.

The Purpose of this Blog

The purpose of this blog or rather Dev Diary is to catalogue the problems and solutions I encounter while making this game. This is for both myself as much as for anyone reading this - as I know from experience that I will solve many issues and forget how I solved them when I come across them again.

Also

This is the first time I've used Blogger so things may look a little rough for awhile.