Cannot do an Android Build with Android SDK 7

I have installed the Android SDK but I cannot select it when the Android build asks for it. The selection window perpetually returns when I select the folder.

I did not have the Android SDK installed properly and the Unity Android selection told me about it nicely. It just will not select now that I have installed the Android SDK.

My Android SDK seems to work, I can create and run a virtual device.

I am using Unity 3.0.0.b7 on Windows 7 64bit. My Android sdk is r07.

I wonder if the problem is using the latest Android sdk. My co-worker is using an older sdk r6 and it works fine.

This problem has been asked twice on Unity Answers with no answers, I wondering if there is something going on.

Does this work in B5? I just started and upgraded to b7 without trying it in B5. I don’t know how to find B6 if there is one since the link I have is for B5.

It works fine for me with b7, but on a Mac. So maybe you are experiencing a problem that’s specific to Windows.

We had the exact same problem on 3 different PC’s (win7 32 and 64 bit and Vista 64 bit). We still don’t have a workaround.
All other installations on WinXP PC’s worked fine!
We installed the latest beta7.

Any word from Unity about this this problem about a way to get it working.

Has anyone got Android builds working with the Unity beta on Windows 7

I do not think regressing to Windows XP from Windows 7 is a answer. I actually moved off Windows XP because of Unity. I could not import because XP sees my 2GB graphics card as having negative memory which resulted in greatly restricting the size of my Unity imports.

From the Beta usergroup:
[…]

Sorry, it seems a .jar file was removed (apkbuilder.jar was integrated
into sdklib.jar) in the latest SDK; will fix this promptly (will be part of
RC1).

Hopefully we should be able to fix that too…

Erik Hemming

When is RC1?

Hopefully, this will be helpful to some. These forums have provided me with unbelievably helpful information over the last year, and so I need to give back when I can. So, here it is.

With Beta7, and armed with that little bit of information about sdklib.jar, here’s what you need to do to get it working with all those cool Nexus One devices we were all sent.

This is specific to Windows. I haven’t tried on the Mac but plenty of folks are saying their Mac’s work fine.

After installing the SDK, simply rename or copy sdklib.jar to apkbuilder.jar. (yeah, I know… you figured that out already).

You should be able to build the APK at this point through Unity.

Connect your phone to the computer through the USB. Do not mount the phone as a USB device.

Go to your phone’s Settings menu->Applications->Unknown sources. Turn this ON.

Next, go to Settings->Applications->Development->USB Debugging. Turn this ON.

Plug-n-play will now pick up your phone and install the USB driver if it hasn’t already. If you installed the SDK correctly and added the add-ons and such that you should have been prompted for, you can find the USB driver that is suitable for the Nexus one in …\android-sdk-windows\usb_driver.

You can double check this by running SDK Manager, looking at the USB driver and make sure it says “Rev 3” (or maybe Revision 3). Revision 3 is the one that added the Nexus One support.

Now you need to push your APK onto the device. In the SDK tools directory, you will find ADB.EXE. From the command prompt (or for the run prompt):

adb install Mypackage.apk

I had the best luck with this by moving the apk into the tools directory, but this was simply because my directory names contain spaces and I did’t fuss with quotes around the directory path.

IF you receive the error “Device not connected”, then you probably didn’t install the USB driver correctly. Open up Device Manager, click on the USB device. Mine actually said “Nexus One” on it and had a yellow “yeah, I’m broken icon”. Right click and “Update Driver”. Point it at the SDK\usb_driver directory and follow the directions, ignoring the error about driver signing and using it at your own risk.

I hope folks find this useful. Best of luck.

See you in Montreal.

Thanks for this simple workaround. Now we don’t have to wait for RC1.

This didn’t work for me as I have an HTC Desire (with Android 2.2 of course). For all HTC Desire users you can use the HTC Sync software and choose Custom Installation and deselect both programs so it installs only the needed drivers.

I just tried it… It’s actually COPY sdklib.jar to apkbuilder.jar(and not rename!). If you do a rename, Unity does find the android sdk folder, but will still complain about no platforms found!

Please try with RC1; it should be fixed now.

Having the same issue with RC1 on Mac using android 2.2
I definitely have the platforms installed and can build fine using Eclipse and the Android SDK.
Previous copy rename solution did not work for me either.
any suggestions?
thanks

Weird, I’ve had no major issues with SDK 7 thats running on Windows 7 x64. Made a quick Roll-A-Ball game and so far was able to publish to a Droid Incredible (one thats rooted and one thats not), Droid 2, Samsung Epic (rooted), Droid X, and HTC Eris. Only problem I had was the apk would not push to the Eris through ADB and I had to push the apk to the SD card and install it manually. I don’t know why the Eris was giving me issues because I could ADB shell with no problems.

I see you tested with Eris. In my experience, I could only get a build to run if I used the “Universal” Device Filter setting and then the app ran in compatibility mode and very very poorly. Was this your experience as well on the Eris?

Just got UnityPro/AndroidPro and not having very good luck here. Even thought I had selected the Android SDK directory in Preferences, I got the “Detecting Android SDK” dialog where it is “Trying to locate the Android SDK installation folder…” and it is now Not responding. Can’t cancel the dialog, and had to kill it via Task Manager. Win7+64 bit as well. My Android SDK is installed in c:\android-sdk-windows, creating a junction in “c:\program files\android-sdk-windows” doesn’t help.

I am having this problem with Unity 3.3.0. I can’t build Android applications. It gets stuck looking for the Android SDK. Mine is in “C:\Users\icarus\Documents\android-sdk-windows”. I set it up in the preferences. But, when I try to build an Android app, it gets stuck looking for the SDK. Then I have to force close it and when I restart Unity, it forgets about the location I set in the preferences.

I am running 64 Bit Windows 7.

Try my suggestion from http://forum.unity3d.com/threads/71150-Unity-freezes-while-building-APK
Put the subfolder platform-tools in your path

The android sdk tools directory, and the platform-tools directory is in my path

Here is my path:

echo %path%

C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files\Common Files\Microsoft Shared
Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C
:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windo
wsPowerShell\v1.0;C:\Program Files\Dell\DW WLAN Card\Driver;c:\Program Files\WI
DCOMM\Bluetooth Software;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C
:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;c:\Program Files (x86)\Micro
soft SQL Server\100\Tools\Binn;c:\Program Files\Microsoft SQL Server\100\Tools
Binn;c:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)
\Windows Live\Shared;C:\Program Files (x86)\Common Files\Teleca Shared;C:\Progra
m Files (x86)\Autodesk\Backburner;C:\Program Files (x86)\Common Files\Autodesk
Shared;C:\Program Files\Common Files\Autodesk Shared;C:\Program Files (x86)\Qu
ickTime\QTSystem;C:\Program Files (x86)\Android\android-sdk-windows;C:\Program
Files (x86)\Android\android-sdk-windows\tools;C:\Program Files (x86)\Android\an
**droid-sdk-windows\platform-tools;**C:\Ruby191\bin;C:\Program Files (x86)\w3af;C:\P
rogram Files (x86)\Unity\MonoDevelop\bin;C:\Python27;C:\Program Files (x86)\Java
\jre6\bin;C:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files\Oracle\VirtualB
ox;

  1. adb is in my path, I can launch a command prompt and run ADB and it works fine.

I set up the Android SDK directory to be: C:\Program Files (x86)\Android\android-sdk-windows

This is what is in that directory:

Directory of C:\Program Files (x86)\Android\android-sdk-windows

3/02/2011 05:10 PM .
3/02/2011 05:10 PM …
3/02/2011 04:35 PM add-ons
3/02/2011 05:08 PM docs
3/02/2011 05:10 PM extras
3/02/2011 05:04 PM platform-tools
3/02/2011 04:47 PM platforms
3/02/2011 05:10 PM samples
2/16/2011 11:49 PM 361,758 SDK Manager.exe
2/17/2011 11:40 AM 1,129 SDK Readme.txt
3/02/2011 05:13 PM temp
3/02/2011 04:28 PM tools
3/02/2011 04:28 PM 70,966 uninstall.exe
3 File(s) 433,853 bytes
10 Dir(s) 179,378,053,120 bytes free

This is what is in the platforms subdirectory:

Directory of C:\Program Files (x86)\Android\android-sdk-windows\platforms

03/02/2011 04:47 PM .
03/02/2011 04:47 PM …
03/02/2011 04:45 PM android-10
03/02/2011 04:47 PM android-11
03/02/2011 04:40 PM android-2
03/02/2011 04:41 PM android-3
03/02/2011 04:41 PM android-4
03/02/2011 04:41 PM android-5
03/02/2011 04:42 PM android-6
03/02/2011 04:42 PM android-7
03/02/2011 04:43 PM android-8
03/02/2011 04:44 PM android-9
03/02/2011 04:48 PM android-Honeycomb
0 File(s) 0 bytes
13 Dir(s) 179,378,036,736 bytes free

I go into the player preferences and enter the passwords for my signing keys.

Then I select build. Unity hangs while trying to locate the Android SDK.

Any other ideas?

Some further information:

**Unity queries HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot several times. **

7:12:09.9065099 PM Unity.exe 3220 RegQueryValue HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot SUCCESS Type: REG_SZ, Length: 102, Data: C:/Program Files (x86)/Android/android-sdk-windows
7:12:09.9066800 PM Unity.exe 3220 RegQueryValue HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot SUCCESS Type: REG_SZ, Length: 102, Data: C:/Program Files (x86)/Android/android-sdk-windows
7:12:09.9069604 PM Unity.exe 3220 RegQueryValue HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot SUCCESS Type: REG_SZ, Length: 102, Data: C:/Program Files (x86)/Android/android-sdk-windows
7:12:09.9070935 PM Unity.exe 3220 RegQueryValue HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot SUCCESS Type: REG_SZ, Length: 102, Data: C:/Program Files (x86)/Android/android-sdk-windows
7:12:09.9072746 PM Unity.exe 3220 RegCloseKey HKCU\Software\Unity Technologies\Unity Editor 3.x SUCCESS
7:12:09.9074849 PM Unity.exe 3220 RegQueryKey HKCU SUCCESS Query: HandleTags, HandleTags: 0x0
7:12:09.9076330 PM Unity.exe 3220 RegCreateKey HKCU\Software\Unity Technologies\Unity Editor 3.x SUCCESS Desired Access: Maximum Allowed, Granted Access: All Access
7:12:09.9077756 PM Unity.exe 3220 RegSetInfoKey HKCU\Software\Unity Technologies\Unity Editor 3.x SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:09.9078992 PM Unity.exe 3220 RegQueryKey HKCU\Software\Unity Technologies\Unity Editor 3.x SUCCESS Query: HandleTags, HandleTags: 0x400

Unity then Clears the AndroidSdkRoot registry key:

7:12:09.9083214 PM Unity.exe 3220 RegSetValue HKCU\Software\Unity Technologies\Unity Editor 3.x\AndroidSdkRoot SUCCESS Type: REG_SZ, Length: 2, Data:
7:12:09.9086026 PM Unity.exe 3220 RegCloseKey HKCU\Software\Unity Technologies\Unity Editor 3.x SUCCESS

It apparently tries to look up something related to java and fails:

7:12:10.1671366 PM Unity.exe 3220 RegOpenKey HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\Image File Execution Options\java.exe NAME NOT FOUND Desired Access: Query Value, Enumerate Sub
Keys

Apparently, it still executes java.exe:

7:12:10.1711968 PM Unity.exe 3220 Process Create C:\Program Files (x86)\Java\jdk1.6.0_24\bin\java.exe SUCCESS PID: 3328, Command line: “C:\Program Files (x86)\Java\jdk1.6.0_24\bin\java.exe” -Dcom.android.sdkmanager.toolsdir=“C:/Program Files (x86)/Android/android-sdk-windows\tools” -classpath “C:/Program Files (x86)/Android/android-sdk-windows\tools\lib\sdkmanager.jar” com.android.sdkmanager.Main list targets
7:12:10.1721822 PM Unity.exe 3220 Load Image C:\Program Files (x86)\Java\jdk1.6.0_24\bin\java.exe SUCCESS Image Base: 0x9d00000, Image Size: 0x24000
7:12:10.1750862 PM Unity.exe 3220 RegOpenKey HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders SUCCESS Desired Access: Query Value
7:12:10.1752713 PM Unity.exe 3220 RegSetInfoKey HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:10.1753721 PM Unity.exe 3220 RegQueryValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache SUCCESS Type: REG_SZ, Length: 146, Data: C:\Users\icarus\AppData\Local\Microsoft\Windows\Temporary Internet Files
7:12:10.1755335 PM Unity.exe 3220 RegCloseKey HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders SUCCESS
7:12:10.1756698 PM Unity.exe 3220 RegOpenKey HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers SUCCESS Desired Access: Read
7:12:10.1758628 PM Unity.exe 3220 RegSetInfoKey HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags\Layers SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0

It gets an error trying to read something related to java again. It keeps trying to read this key several times and then a bunch of threads exit.

7:12:10.1759793 PM Unity.exe 3220 RegQueryValue HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags\Layers\C:\Program Files (x86)\Java\jdk1.6.0_24\bin\java.exe NAME NOT FOUND Length: 1,024
7:12:10.1761117 PM Unity.exe 3220 RegCloseKey HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags\Layers SUCCESS
7:12:10.1762747 PM Unity.exe 3220 RegOpenKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers SUCCESS Desired Access: Read
7:12:10.1764094 PM Unity.exe 3220 RegSetInfoKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:10.1765086 PM Unity.exe 3220 RegQueryValue HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Program Files (x86)\Java\jdk1.6.0_24\bin\java.exe NAME NOT FOUND Length: 1,024
7:12:10.1766315 PM Unity.exe 3220 RegCloseKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers SUCCESS
7:12:10.1767599 PM Unity.exe 3220 RegOpenKey HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Custom\java.exe NAME NOT FOUND Desired Access: Read
7:12:10.2026352 PM Unity.exe 3220 RegOpenKey HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags SUCCESS Desired Access: Read
7:12:10.2028148 PM Unity.exe 3220 RegSetInfoKey HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:10.2029116 PM Unity.exe 3220 RegQueryValue HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags{22624cac-fe50-451e-9261-e7f22aab93ec} NAME NOT FOUND Length: 1,024
7:12:10.2030180 PM Unity.exe 3220 RegCloseKey HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AppCompatFlags SUCCESS
7:12:10.2031834 PM Unity.exe 3220 RegOpenKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags SUCCESS Desired Access: Read
7:12:10.2033385 PM Unity.exe 3220 RegSetInfoKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:10.2034331 PM Unity.exe 3220 RegQueryValue HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags{22624cac-fe50-451e-9261-e7f22aab93ec} NAME NOT FOUND Length: 1,024
7:12:10.2035323 PM Unity.exe 3220 RegCloseKey HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags SUCCESS
7:12:10.2234082 PM Unity.exe 3220 RegOpenKey HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\SideBySide SUCCESS Desired Access: Read
7:12:10.2236004 PM Unity.exe 3220 RegSetInfoKey HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SideBySide SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
7:12:10.2236980 PM Unity.exe 3220 RegQueryValue HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SideBySide\PreferExternalManifest NAME NOT FOUND Length: 20
7:12:10.2238193 PM Unity.exe 3220 RegCloseKey HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SideBySide SUCCESS
7:12:38.6316191 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 4356, User Time: 0.0936006, Kernel Time: 0.0780005
7:12:38.8576373 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 3676, User Time: 0.0000000, Kernel Time: 0.0000000
7:12:42.6823599 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 3508, User Time: 0.0156001, Kernel Time: 0.0000000
7:12:42.6875339 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 3696, User Time: 0.0312002, Kernel Time: 0.0000000
7:13:16.8925412 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 328, User Time: 0.0312002, Kernel Time: 0.0156001
7:13:26.0061020 PM Unity.exe 3220 Thread Create SUCCESS Thread ID: 3816
7:14:33.0127095 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 2776, User Time: 0.0156001, Kernel Time: 0.0156001
7:16:04.7631246 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 664, User Time: 0.0000000, Kernel Time: 0.0000000
7:17:30.9541640 PM Unity.exe 3220 Thread Create SUCCESS Thread ID: 5684
7:18:37.9570948 PM Unity.exe 3220 Thread Exit SUCCESS Thread ID: 3816, User Time: 0.0000000, Kernel Time: 0.0000000

So, maybe this is something related to the configuration of Java? this is the version of java I have installed:

java -version

java version “1.6.0_21”
Java™ SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot™ 64-Bit Server VM (build 17.0-b17, mixed mode)

I don’t know if this is related, but looks like you have a 32 bit jre on your system, and a 64 bit jdk?
C:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Java\jdk1.6.0_21\bin

On my system, I only have a 64 bit jdk installed

I finally got this working. I did a lot of stuff and I am not 100% sure which thing fixed it. But here is what I did:

  • Uninstalled all the versions of Java and the JDK.
  • Removed all java related paths from my PATH environment variables.
  • Removed all Android-sdk related paths from my PATH environment variables
  • Downloaded and installed the 64-bit version of the Java SE SDK
  • Reinstalled Unity
  • Repartitioned my hard drive to have a F: drive dedicated to the Android SDK
  • Disabled UAC
  • Downloaded and installed the Android SDK from the zip file to F:\android-sdk-windows
  • Add/updated my PATH environment variable to include the following:
    F:\android-sdk-windows
    F:\android-sdk-windows\tools
    F:\android-sdk-windows\platform-tools
    F:\android-sdk-windows\platforms\android-8\tools
    C:\Program Files\Java\jdk1.6.0_24\bin
    (Note: The Java path must include the path to a Java SDK (as opposed to a JRE) bin directory so that you have utilities like keytool in your path.)
  • Set the Android-SDK location in Unity to F:\android-sdk-windows\