Build Run problem on HTC Desire + Unity 3.3

Hi all!
I have a simple app with camera and skybox. When I execute Build Run I always get two errors:

first

Error building Player: ArgumentOutOfRangeException: Cannot be negative.
Parameter name: length
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

second

Exception: Error building Player: ArgumentOutOfRangeException: Cannot be negative.
Parameter name: length
UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:341)
UnityEditor.BuildPlayerWindow.BuildPlayerAndRun () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:263)

These errors occur when I try to execute app on my phone(HTC Desire). If I execute app on the emulator when it starts and word perfectly. What is the cause of this problem?

adb devices output:

PS D:\Development\projects\unity\UnityAndroidTest> adb devices
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached
HT041PL08504    device

Unity ver: 3.3.04f(63135)
android ver: 2.2
Full Error Log:

BatchMode: 0, IsHumanControllingUs: 1, StartBugReporterOnCrash: 1, shouldGiveDebuggerChanceToAttach: 0
Initialize mono
Mono path[0] = 'D:/Development/IDEs/Unity/Editor/Data/Mono/lib/mono/2.0'
Mono path[1] = 'D:/Development/IDEs/Unity/Editor/Data/Managed'
Mono path[2] = 'D:/Development/IDEs/Unity/Editor/Data/UnityScript'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y
Direct3D:
    Version:  Direct3D 9.0c [nvd3dum.dll 8.17.12.6666]
    Renderer: NVIDIA GeForce GTX 560 Ti
    Vendor:   NVIDIA
    VRAM:     1024 MB
    Caps:     Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 DF24=0 INTZ=1 RAWZ=0 NULL=1 RESZ=0 SlowINTZ=0
IsTimeToCheckForNewEditor: Update time 1309129162 current 1309164861
LicenseInfo:InitializeProtection
  open PACE from our own executable
  opened PACE, get info...
  checked authorization, authstate=100 r=0
  ReadDeveloperData
  ReadTokens
D:/Development/projects/unity/UnityAndroidTest

Unloading -2 unused Assets to reduce memory usage. Loaded Objects now: 45.
System memory in use: 85.2 MB.
Unloading 20 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Managed\UnityEngine.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Managed\UnityEditor.dll (this message is harmless)
Non platform assembly: data-07197FA8 (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.Other.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\System.Core.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\System.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\UnityScript.dll (this message is harmless)
Mono: successfully reloaded assembly
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\Mono.Cecil.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\System.Xml.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.dll (this message is harmless)

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 255.
System memory in use: 94.6 MB.
Unloading 13 Unused Serialized files (Serialized files now loaded: 1 / Dirty serialized files: 1)
<I> Initializing (RawInput).

<RI> Input initialized.

EditorUpdateCheck: Response {updateinterval: '3600'} updateurl =  interval = 3600
building target 13
- starting compile Library/ScriptAssemblies/Assembly-UnityScript.dll, for buildtarget 13
- Finished compile Library/ScriptAssemblies/Assembly-UnityScript.dll
Warning! Using more than 1 pixel lights on a mobile device may decrease performance severely. You can change the mobile quality settings in 'Project Settings -> Quality Settings'.
 
(Filename: C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Src/BuildPipeline/BuildTargetPlatformSpecific.cpp Line: 135)


Unloading 282 unused Assets to reduce memory usage. Loaded Objects now: 758.
System memory in use: 126.3 MB.
Unloading 1 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)


Mono dependencies included in the build
mscorlib.dll
Assembly-UnityScript.dll


Unloading 265 unused Assets to reduce memory usage. Loaded Objects now: 765.
System memory in use: 137.9 MB.
Unloading 3 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)
Unsupported: Hidden/Shadow-ScreenBlur
Unsupported: Hidden/Camera-DepthTexture
Unsupported: Hidden/Camera-DepthNormalTexture
Unsupported: Hidden/Internal-PrePassLighting
Unsupported: Hidden/Internal-PrePassCollectShadows
Unsupported: Hidden/Internal-CombineDepthNormals
Unsupported: RenderFX/Skybox Cubed
Unsupported: Hidden/TerrainEngine/Details/BillboardWavingDoublePass
Unsupported: Hidden/TerrainEngine/Splatmap/Lightmap-AddPass
Unsupported: Hidden/TerrainEngine/BillboardTree
Unsupported: Hidden/Nature/Tree Soft Occlusion Bark Rendertex
Unsupported: Hidden/Nature/Tree Soft Occlusion Leaves Rendertex
Unsupported: Hidden/Nature/Tree Creator Bark Rendertex
Unsupported: Hidden/Nature/Tree Creator Leaves Rendertex

Textures      170.7 kb	 6.3% 
Meshes        2.7 kb	 0.1% 
Animations    0.0 kb	 0.0% 
Sounds        0.0 kb	 0.0% 
Shaders       0.7 kb	 0.0% 
Other Assets  0.2 kb	 0.0% 
Levels        5.6 kb	 0.2% 
Scripts       20.9 kb	 0.8% 
Included DLLs 2.5 mb	 92.6% 
File headers  1.3 kb	 0.0% 
Complete size 2.7 mb	 100.0% 

Used Assets, sorted by uncompressed size:
 170.7 kb	 6.3% Assets/Standard Assets (Mobile)/Textures/skyBox.tga
 2.7 kb	 0.1% Assets/Standard Assets (Mobile)/Prefabs/Skybox.fbx
 0.7 kb	 0.0% Assets/Standard Assets (Mobile)/Shaders/Vertex Colored Shaders/Mobile Vertex Colored.shader
 0.2 kb	 0.0% Assets/Standard Assets (Mobile)/Materials/skybox.mat
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/PlayerRelativeControl.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/CameraRelativeControl.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/SidescrollControl.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/RotationConstraint.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/FirstPersonControl.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/SmoothFollow2D.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/FollowTransform.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/ZoomCamera.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/TapControl.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/RollABall.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/ObliqueNear.js
 0.1 kb	 0.0% Assets/Standard Assets (Mobile)/Scripts/Joystick.js

Unloading 319 unused Assets to reduce memory usage. Loaded Objects now: 807.
System memory in use: 162.3 MB.
Unloading 20 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)
Error building Player: ArgumentOutOfRangeException: Cannot be negative.

Parameter name: length
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions) (at C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:339)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:263)

[C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Src/Commands/BuildPlayerUtility.cpp line 1534] 
(Filename: C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs Line: 339)

- starting compile Library/ScriptAssemblies/Assembly-UnityScript.dll, for buildtarget 13

*** Cancelled 'Build.Player.AndroidPlayer' in 16 seconds

Exception: Error building Player: ArgumentOutOfRangeException: Cannot be negative.

Parameter name: length
  at UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions) [0x001b1] in C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:341 

  at UnityEditor.BuildPlayerWindow.BuildPlayerAndRun () [0x00000] in C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:263 
 
(Filename: C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs Line: 341)

- Finished compile Library/ScriptAssemblies/Assembly-UnityScript.dll
Non platform assembly: data-0F177D50 (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.dll (this message is harmless)
Platform assembly: D:\Development\IDEs\Unity\Editor\Data\Mono\lib\mono\2.0\I18N.Other.dll (this message is harmless)
Mono: successfully reloaded assembly

The problem is solved. The cause of the problem - adb which doesn`t work with HTC Sync correctly. After uninstall HTC Sync the problem disappeared.

Hours of valuable time wasted…

Thank you for this post :slight_smile:

zipper

I’ve found this with both HTC Sync and Samsung Kies, you don’t need to uninstall them, just exit them while using Unity

Yup this did it.

perfect, it works without problems. thank you very much :smile:

Great, it solved my problem. Thank you!

Thanks a lot. Almost lost any hope)