Search Unity

Error connecting Android sdk to Unity.

Discussion in 'Vuforia' started by Tirth_, Oct 4, 2017.

  1. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    I am trying to learn AR and vuforia. As I have learned on a course online, i have followed following steps,

    1. Download sdk and jdk
    2. specify path in Edit>Preferences>External Tools
    3. go to build setting and click build

    I am facing following errors.

    1)
    Error:Invalid command android

    UnityEditor.HostView:OnGUI()

    2)
    CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    C:/Program Files/Android/Android Studio1/jre\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Tirth/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Error:Invalid command android
    ]
    stdout[

    ]
    exit code: 64
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.HostView:OnGUI()

    3)

    Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    C:/Program Files/Android/Android Studio1/jre\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Tirth/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Error:Invalid command android
    ]
    stdout[

    ]
    exit code: 64

    4)

    UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    UnityEditor.HostView:OnGUI()

    Can anyone please help on where did I go wrong?
     
  2. whitebozo

    whitebozo

    Joined:
    Oct 27, 2014
    Posts:
    29
    I had a similar issue recently I fixed it by getting an older version of a couple of them. I have it working just fine now and here are the versions I'm using.

    You can check the versions you have in the SDK files themselves.

    To check the JDK version open the release file in a text editor
    To check NDK version open the source.properties file in a text editor
    To

    JDK: Java SE 8u144
    NDK: 13.1.3345770

    Not sure if this was what fixed it or not as I tried a bunch of stuff I found online to fix it.
     
    Tirth_ likes this.
  3. whitebozo

    whitebozo

    Joined:
    Oct 27, 2014
    Posts:
    29
    I feel like JDK SE 9 was the problem for me I don't remember though.
     
  4. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    It just shows error: Please check SDK path and for details check the console. I have mentioned console error above.
     
  5. whitebozo

    whitebozo

    Joined:
    Oct 27, 2014
    Posts:
    29
    Those were the same issues I was having as well.
     
    Vuforia-Strasza likes this.
  6. Augmenteer

    Augmenteer

    Joined:
    Aug 30, 2015
    Posts:
    43
    Tirth which versions of Vuforia and Unity are you using, and did you install Android Build Support from the download assistant or are you using an existing Android build environment?
     
  7. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    Unity 2017.1.2f1
    Vuforia SDK v6.2.10
    I have tried both downloading fresh new support after uninstalling and using existing environment.

    Both show the same error.
     
  8. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Hi Tirth_,
    2017.1 is not a supported version of Vuforia 6.2.10. If you plan on using 6.2.10, please download Unity 5.6. Going forward, we recommend going with Unity 2017.2 with the native version of Vuforia (6.5).
    Thanks!
     
  9. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    I'll try upgrading both unity and vuforia and will let you know if it works.
     
    Vuforia-Strasza likes this.
  10. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    Same problem again. With versions I was asked to install and run.
     
  11. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Do you have the latest Android SDKs installed? Which version are you targeting in your app?
     
  12. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    yes, I have lastest SDK installed. Targetting 7.0 Nougat
     
  13. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Which version of the JDK do you have installed? Are you using the Android NDK?
     
  14. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    JDK: 8.0.1410 and no I haven't installed NDK. The error shows please provide correct path for SDK so I didn't bother about NDK much.
     
  15. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Do you only see this issue when you are building with Vuforia included? Or do you see this issue when you try to build to Android regardless of Vuforia inclusion?
     
  16. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    let me give it a try with a normal game , excluding vuforia
     
  17. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    Ya! So facing the same problem while building for android. Hence , now I will try reinstalling applications and try installing and running older versions and let you guys know if it works.
     
  18. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    Chiming in on this one. Experiencing the same problems with
    Unity 2017.2.0b11
    Android Studio 2.2.3 with all necessary packages (building an example app to phone works like a charm)
    JDK 9 and 7. Same error on both.
    Tested both with my project and the sample cores.
    I've also tested with the SDK installed on two diferent locations to be sure Unity can access the folder.
    If a reinstall is needed this will be the 3rd time in less than a month. Not really wanting to do that.
    Excited to see if you find a solution, Tirth_!
     
    Tirth_ likes this.
  19. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Did you two download the SDKs through Unity's External Tools menu?
     
  20. kodierer

    kodierer

    Joined:
    Nov 25, 2014
    Posts:
    8
    I have the same error. I never had this problem with an older version of Unity and an older version of well, everything.

    I guess that is what happens when we try to fix something that isn't broken.
     
  21. kodierer

    kodierer

    Joined:
    Nov 25, 2014
    Posts:
    8
    I downloaded Unity 2017.2, selected to install everything from the Unity installer. There was no Android SDK, so I downloaded Android studio 2.3.3, and used the download manager to install the SDK, and then downloaded JDK 9.0.1

    Doesn't work. Perhaps they'll fix everything so it will work with the most up to date SDK's soon.
     
  22. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    yes
     
  23. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    Vuforia-Strasza likes this.
  24. Tirth_

    Tirth_

    Joined:
    Jul 12, 2017
    Posts:
    11
    Great that you found the solution, but I would still give it a try with older versions to make sure that I am doing it right. :)
     
    Vuforia-Strasza and marthetra like this.
  25. kodierer

    kodierer

    Joined:
    Nov 25, 2014
    Posts:
    8
    I'm fairly certain android SDK is the culprit.
    I tried downgrading the JDK to 8, and it doesn't do anything different.
     
    Tirth_ likes this.
  26. kodierer

    kodierer

    Joined:
    Nov 25, 2014
    Posts:
    8
    If anyone else comes up with this problem, the new SDK Manager would not allow me to download anything. So I uninstalled it, and retrieved an older version of the SDK from my other computer. Version 23.
    It now always tells me I don't have the most up to date version, I click proceed anyways, and it works. Hope this helps someone.
     
    Vuforia-Strasza and Tirth_ like this.