Build Error

I just got the Android version to try porting some iOS games over and I’m running into a problem at build time.
I create a new project, save an empty scene, and try to build it to device. I get 1 warning and 2 errors, but no APK. I was able to get an example project to build from Eclipse, but I have no idea what I’m doing here.

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’.

Error building Player: KeyNotFoundException: The given key was not present in the dictionary.
UnityEditor.HostView:OnGUI()

Exception: Error building Player: KeyNotFoundException: The given key was not present in the dictionary.
UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:341)
UnityEditor.BuildPlayerWindow.GUIBuildButtons (Boolean enableBuildButton, Boolean enableBuildAndRunButton, Boolean canInstallInBuildFolder) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:949)
UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:923)
UnityEditor.BuildPlayerWindow.OnGUI () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs:697)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/DockArea.cs:213)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/DockArea.cs:206)
UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/DockArea.cs:107)

Ok, the first, is yellow and is just a warning, no particular worries unless you have put 10 lights in your scene because it would lag on most devices.

Just read the first lines of the log!

This is about the App (apk) signature. You have to build your own 50 years certificate / key for your app with a password in the player settings !

Otherwise (see attached picture) just check Development Build in the build settings and then you can build the apk and then build&run&transfer it on your device with no signature hassle.

Ya, I’m not worried about the warning (it’s an easy fix), and I am doing a debug build. Sorry, I should have mentioned that.

I think I actually figured this out, but I’m not sure which of the many things I tried fixed it. Here’s my best guess as to the fix:
At first I didn’t have the Path settings for the JDK correct, so I tried to fix that. I added both the JRE and JDK to the path settings. I suspect having the JRE in the path was confusing things. Once I removed the JRE directory and added the JAVA_HOME key, things started working.

I got it running in the simulator, but I’ll try it on hardware tomorrow.

Same error here:

Error building Player: KeyNotFoundException: The given key was not present in the dictionary.

I have tried with Development Build but same result (same error).
This bug SUCKS!!!

Only:
Error building Player: KeyNotFoundException: The given key was not present in the dictionary.
no more details!!!

How can I fix this bug???

Hi, sorry, that error is really bad - extremely uninformative :frowning: I will try to fix this for the next unity version… The usual cause of this error is an unstable adb connection. This is usually caused by one of three things

  1. You have some program interfering with adb, like Samsung Kies etc.
  2. The USB cable is bad - this is actually a very common problem.
  3. The device you are using is unstable / have unstable version of adb / running an unstable custom rom.

Yeah I realised that - turning wifi off and on would clear it, and I’d have to adb connect again before it went through. Be nice to have some clearer errors going forward :slight_smile:

i got this error when i updated to unity 4.2, anyone know how to fix it?
even when development build is checked, the error is still happening. also created a keystore, still happens. (using the same working keystore in unity 4.0/4.1) but in 4.2 not working.

tried a fresh install on the ADT bundle too.
tried another mac. another device, and cable. still not working :frowning:

need help, searched google, couldnt find an answer.

edit:
hm, still couldn’t make it to work. so i went to build the project in eclipse instead :frowning:

still no fix for this? :frowning: i can build, but it’s time consuming… :frowning:

Can you try:

adb shell getprop

and tell me what the output is. Also if you could file a bug report on this would be very helpful.

I have the same issue (I can build apk, but NOT build and run the .apk - development mode does not fix this either). Ive made keystore/key correctly, nothing has stopped the error.

adb is not in my PATH as it turns out…could that be an issue? Ill add and see.

output of my adb shell getprop is:

Sando:platform-tools sando$ ./adb shell getprop
[ARGH]: [ARGH]
[dalvik.vm.heapsize]: [32m]
[dalvik.vm.stack-trace-file]: [/data/anr/traces.txt]
[dev.bootcomplete]: [1]
[gsm.current.phone-type]: [1]
[gsm.defaultpdpcontext.active]: [true]
[gsm.network.type]: [Unknown]
[gsm.operator.alpha]: [Android]
[gsm.operator.iso-country]: [us]
[gsm.operator.isroaming]: [false]
[gsm.operator.numeric]: [310260]
[gsm.sim.operator.alpha]: [ ]
[gsm.sim.operator.iso-country]: [us]
[gsm.sim.operator.numeric]: [310260]
[gsm.sim.state]: [READY]
[gsm.version.baseband]: [ ]
[gsm.version.ril-impl]: [android reference-ril 1.0]
[init.svc.adbd]: [running]
[init.svc.bootanim]: [stopped]
[init.svc.console]: [running]
[init.svc.debuggerd]: [running]
[init.svc.drm]: [running]
[init.svc.goldfish-logcat]: [stopped]
[init.svc.goldfish-setup]: [stopped]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.media]: [running]
[init.svc.netd]: [running]
[init.svc.qemu-props]: [stopped]
[init.svc.qemud]: [running]
[init.svc.ril-daemon]: [running]
[init.svc.servicemanager]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.ueventd]: [running]
[init.svc.vold]: [running]
[init.svc.zygote]: [running]
[net.bt.name]: [Android]
[net.change]: [net.dns2]
[net.dns1]: [10.0.2.3]
[net.dns2]: [10.0.2.4]
[net.eth0.dns1]: [10.0.2.3]
[net.eth0.dns2]: [10.0.2.4]
[net.eth0.gw]: [10.0.2.2]
[net.gprs.local-ip]: [10.0.2.15]
[net.hostname]: [android-d00852c6b4982206]
[net.qtaguid_enabled]: [0]
[net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208]
[net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040]
[net.tcp.buffersize.evdo]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680]
[net.tcp.buffersize.hsdpa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.hspap]: [4094,87380,1220608,4096,16384,1220608]
[net.tcp.buffersize.hsupa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576]
[net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208]
[net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576]
[persist.sys.country]: [US]
[persist.sys.language]: [en]
[persist.sys.localevar]: [ ]
[persist.sys.profiler_ms]: [0]
[persist.sys.timezone]: [America/New_York]
[persist.sys.usb.config]: [adb]
[qemu.hw.mainkeys]: [0]
[qemu.sf.fake_camera]: [back]
[qemu.sf.lcd_density]: [213]
[rild.libargs]: [-d /dev/ttyS0]
[rild.libpath]: [/system/lib/libreference-ril.so]
[ro.allow.mock.location]: [1]
[ro.baseband]: [unknown]
[ro.board.platform]: [ ]
[ro.bootloader]: [unknown]
[ro.bootmode]: [unknown]
[ro.build.characteristics]: [default]
[ro.build.date.utc]: [1373507351]
[ro.build.date]: [Thu Jul 11 01:49:11 UTC 2013]
[ro.build.description]: [sdk-eng 4.3 JWR66V 737497 test-keys]
[ro.build.display.id]: [sdk-eng 4.3 JWR66V 737497 test-keys]
[ro.build.fingerprint]: [generic/sdk/generic:4.3/JWR66V/737497:eng/test-keys]
[ro.build.host]: [wpee19.hot.corp.google.com]
[ro.build.id]: [JWR66V]
[ro.build.product]: [generic]
[ro.build.tags]: [test-keys]
[ro.build.type]: [eng]
[ro.build.user]: [android-build]
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [737497]
[ro.build.version.release]: [4.3]
[ro.build.version.sdk]: [18]
[ro.com.google.locationfeatures]: [1]
[ro.config.alarm_alert]: [Alarm_Classic.ogg]
[ro.config.nocheckin]: [yes]
[ro.config.notification_sound]: [OnTheHunt.ogg]
[ro.debuggable]: [1]
[ro.factorytest]: [0]
[ro.hardware]: [goldfish]
[ro.kernel.android.checkjni]: [1]
[ro.kernel.android.qemud]: [ttyS1]
[ro.kernel.console]: [ttyS0]
[ro.kernel.ndns]: [2]
[ro.kernel.qemu.gles]: [1]
[ro.kernel.qemu]: [1]
[ro.product.board]: [ ]
[ro.product.brand]: [generic]
[ro.product.cpu.abi2]: [armeabi]
[ro.product.cpu.abi]: [armeabi-v7a]
[ro.product.device]: [generic]
[ro.product.locale.language]: [en]
[ro.product.locale.region]: [US]
[ro.product.manufacturer]: [unknown]
[ro.product.model]: [sdk]
[ro.product.name]: [sdk]
[ro.radio.use-ppp]: [no]
[ro.revision]: [0]
[ro.runtime.firstboot]: [1375826121661]
[ro.secure]: [0]
[ro.serialno]: [ ]
[ro.setupwizard.mode]: [EMULATOR]
[ro.wifi.channels]: [ ]
[service.bootanim.exit]: [1]
[status.battery.level]: [5]
[status.battery.level_raw]: [50]
[status.battery.level_scale]: [9]
[status.battery.state]: [Slow]
[sys.boot_completed]: [1]
[sys.settings_secure_version]: [1]
[sys.usb.config]: [adb]
[sys.usb.state]: [adb]
[system_init.startsurfaceflinger]: [0]
[wlan.driver.status]: [unloaded]
[xmpp.auto-presence]: [true]

Any help or advice would be great, thanks.

-Sean

What is that? Is it the Android emulator? It’s certainly not a proper device :wink: It’s lacking a lot of properties that we need to check device compatibility. Even lacks a proper serialno. I will make a fix that ignores empty properties. In the meantime try using a proper device for deployment.

yes its the ADT emulator–a google nexus 7 emulated by the latest version of the Android Developer Tools

Build: v22.0.5-757759

Id imagine a lot more poeple will be deploying to emulators to debug vs real devices since you can test lots of OS flavors, resolutions, et al.

I will try a device and see if that works.

here’s mine

and another

btw is there a collapsable tag/code here or code code lol other than quote? XD coz it’s so long…

so thanks for helping! sorry for late reply… been busy with other stuffs…

guess what, it’s ok now. tried reproducing it on a new project to file a bug report but i couldnt. then tried the project that has this error, it was a success! no more error! i dont know what i did to make this thing work XD

thanks

@bitter

it’s happening again :frowning: with this device, but on the other is not.

that’s the adb shell getprop on the device that’s getting the error again… thanks for the help

My phone just stopped working with the same error, too. Guess it updated, this helped me:
Settings → Security → Unknown sources → Allow installing non-Play Store applications

yep mine is already checked… i’ll try unchecking it and see what happens :wink:

edit:
no luck. :frowning:

Hi unleech !

I’m having the same issue by my side, only for Build Run stuff… Here’s my output for the adb shell getprop.

If anyone is still having issues with this, try deleting any Builds you made inside of the Assets folder.