0

I'm trying to simply build the Cardboard demo found here: https://developers.google.com/cardboard/unity/download#cardboard_sdk_for_unity_and_demo

I've followed all the instructions rigorously, I have all the right SDKs and their paths, I have an old LG E Android phone 4.1.2, which my computer is able to connect to, and as Unity is pushing the APK to the phone I get a little pop up message with the following error:

CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details. 
C:/Users/Cristina.GrstLightning/AppData/Local/Android/sdk\platform-tools\adb.exe -s "LG-E973-1c8ab70a" install -r "C:\Users\Cristina.GrstLightning\Documents\New Unity Project\Temp\StagingArea\Package.apk"

stderr[
158 KB/s (851968 bytes in 5.242s)
- waiting for device -
]
stdout[
rm failed for -f, No such file or directory

]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.ADB.RunInternal (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.ADB.Run (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidDevice.Exec (System.String[] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidDevice.Install (System.String apkfile, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessAndroidPlayer.UploadAndStartPlayer (System.String manifestName, System.String stagingArea, UnityEditor.Android.AndroidDevice device, System.String packageName, Boolean developmentPlayer, Boolean retryUpload)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.HostView:OnGUI()

I've also tried building the project and side-loading it on the phone. Then I get get a parse error and it doesn't install.

Here is a screen shot of the setting of my build in Unity: Other Settings

I'm not new to Unity but I'm new to Android and Cardboard, so I don't even know where to begin with what the console is telling me, other than yes, I do have the right SDK and its path.

I get the sense that my phone is getting in the way of itself. What mean by that is that as Unity is pushing the apk it looks for its driver again and opens an explorer window on the desktop, then I get a build failure error.

CM.Dev
  • 1
  • 4
  • What unity version? can your adb see your android phone when you do `adb devices` from the command line? – Programmer May 13 '16 at 02:07
  • Thanks for the prompt reply, Unity is 5.3.4 .. I haven't done anything with command line yet.. and I didn't know what adb was until I googled it right now – CM.Dev May 13 '16 at 02:11
  • Ok, I've gone ahead and found adb and typed adb devices, and yes it sees my phone. I did install its drivers. – CM.Dev May 13 '16 at 02:19
  • Ok. Your driver is fine. Will provide answer in a moment. – Programmer May 13 '16 at 02:20

1 Answers1

1

Try this from my other solutions. I see no need to re-post it because it is a long process. It should definitely work for you. Don't skip any step. Comment if that didn't work.

https://stackoverflow.com/a/36959457/3785314

EDIT:

If the solution above fails, open Task Manager->Select the Processes tab, look for adb.exe under Background Processes(###). Right click on it and click End task.

Community
  • 1
  • 1
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • @CM.Dev ok will be waiting to hear what happens – Programmer May 13 '16 at 02:42
  • ok, I'll try that now.. the long process failed.. still much the same error.. haaving trouble editing my original post because it the for thinks that my console error copy-paste is a link – CM.Dev May 13 '16 at 04:36
  • @CM.Dev what version of unity do you have now? also post the error at pastebin.com if you are having problems posting it – Programmer May 13 '16 at 04:59
  • 5.4 beta, as per your instructions – CM.Dev May 13 '16 at 04:59
  • pastebin dot com prf3B95N – CM.Dev May 13 '16 at 05:01
  • @CM.Dev ok. post a screenshot of your unity preferences like this one: i.stack.imgur.com/W7EqX.png – Programmer May 13 '16 at 05:09
  • I can't post more screen shots as this is my first question ever on stackoverflow but these are my paths: C:/AndroidSDK/android-sdk-windows and C:/Program Files/Java/jdk1.8.0_60 – CM.Dev May 13 '16 at 05:13
  • @CM.Dev You can post image on imgur.com and post the link here. Please post the image and also post this one http://i.stack.imgur.com/B7q7T.png if possible. That I can use to trace what's really going on. Before posting the image, please create a **NEW** empty project and try to run it on the Android. A new project. – Programmer May 13 '16 at 05:19
  • @CM.Dev Did you try the new project stuff I said? Also please install **Android SDK Build-tools 23.0.2.** The second image shows that it is not installed. – Programmer May 13 '16 at 05:37
  • no dice with the new empty project; same error: http://pastebin.com/bnNPixzs additionally this is the screen capture of my phone http://imgur.com/zPswnex after the explorer window opens on the desktop, the build fails – CM.Dev May 13 '16 at 05:38
  • @CM.Dev Wait a minute. Click only **Build** instead of **Build And Run**. Let me know if Build built without error. – Programmer May 13 '16 at 05:42
  • yes, that it does, from the get go. As I stated before, I had tried sideloading the apk as well, and I would get a parse error upon installing – CM.Dev May 13 '16 at 05:47
  • downloaded 23.0.2 .. no change for the better – CM.Dev May 13 '16 at 05:48
  • @CM.Dev You did not answer my last question.I am confused with your reply. Does only **Build** compile without error? Does it build APK successfully? – Programmer May 13 '16 at 05:54
  • yes, it builds without error. I said I had tried that before too and then tried side-loading the apk onto the phone, which resulted in a parse error upon installation – CM.Dev May 13 '16 at 05:57
  • @CM.Dev You fixed the Unity side of the problem. That's good. There are two more problems to be fixed. – Programmer May 13 '16 at 06:00
  • The Second image you posted here http://imgur.com/a/v0OX1 says that your API location is set to **C:\AndroidSDK\sdk** while your Unity program(First picture) says that your SDK is located at **C:\AndroidSDK\Android-sdk-windows** It looks like you did not follow the direction well. You need to fix this problem before I do the final step. – Programmer May 13 '16 at 06:03
  • I'm listening :) I actually just side loaded the empty project and it installs but stops working upon opening, I imagine because it's empty – CM.Dev May 13 '16 at 06:03
  • @CM.Dev Upload new picture after fixing. Picture of both of them like you did here http://imgur.com/a/v0OX1 . You can easily fix it by just changing C:\AndroidSDK\Android-sdk-windows to C:\AndroidSDK\sdk in Unity. – Programmer May 13 '16 at 06:05
  • @CM.Dev Please upload image for unity settings too. Like you did here http://imgur.com/a/v0OX1 **Build** then tell me what happens. Then **Build and Run** then tell me what happens. Post error if there is one. – Programmer May 13 '16 at 06:14
  • @CM.Dev So I am waiting for a reply of what happened when you tried what I posted above.... – Programmer May 13 '16 at 06:21
  • ok so build failed via the usb cable. Same thing as before: it looks for the driver and when the explorer window opens, it fails. I side-loaded it via my wireless connection and it installed, it just closes upon opening. Maybe I'll try a simple scene with a cube – CM.Dev May 13 '16 at 06:22
  • I made a scene with a cube, built and side loaded the apk, it installs but quits upon opening – CM.Dev May 13 '16 at 06:26
  • You really don't understand me. You should be doing this with a simple scene or empty scene. It must also be a new project. There are reasons for this. – Programmer May 13 '16 at 06:27
  • @CM.Dev Also I said do Build only and tell me if Unity throws an error. Build will just create an apk file. Then do Build and Run from Unity and tell me if it worked or not then link any error here. You didn't tell me if Build worked or not or if Build and Run worked. That puts me to repeat stuff over and over.. – Programmer May 13 '16 at 06:27
  • I said that build on its own throws no error. Build and run does. As of now this is the error http://pastebin.com/r1FH50VK It was an empty project until I added the scene with the cube 1 minute ago ..no change – CM.Dev May 13 '16 at 06:31
  • @CM.Dev Ok. This problem does not look like it is from Unity. There is an uploading problem. Please post picture of your phone. I want to see it is showing on the screen. Also post picture of your player settings from unity – Programmer May 13 '16 at 06:37
  • http://imgur.com/a/0cv9N ok, so the first picture is the phone asking for the driver, after which, like I've said before, the build fails. I did sideload the apk via wireless and installed it, but it closes upon opening. The last picure are the player settings – CM.Dev May 13 '16 at 06:45
  • @CM.Dev Alright good. Click **Skip** on the phone then click **Charge only**. Do that each time that pops up. – Programmer May 13 '16 at 06:53
  • Disconnect your Android device from the local network/Wifi – Programmer May 13 '16 at 06:53
  • Open command prompt on your pc, change your directory to where the sdk is and run command `adb devices`. Post a screen show of what you got. – Programmer May 13 '16 at 06:53
  • @CM.Dev If you are struggling with this, I have an answer on how to do that. http://stackoverflow.com/a/36825304/3785314 – Programmer May 13 '16 at 07:06
  • ok, so http://imgur.com/a/GPFeI I'm doing something wrong with the command line.. I turned off wireless, I kept hitting charge only and essentially it fails by usb and error in console is: http://pastebin.com/JVqVJKyu ... oh adb was in the platform tools folder .. just ran the command.. it sees the phone http://imgur.com/Fvchvj8 – CM.Dev May 13 '16 at 07:09
  • @CM.Dev First of all please stop trying unity. just only do the cmd stuff I said – Programmer May 13 '16 at 07:13
  • You missed \platform-tools at the end of the path – Programmer May 13 '16 at 07:13
  • It should be `cd /d C:\AndroidSDK\sdk\platform-tools` – Programmer May 13 '16 at 07:14
  • just re-did it .. I edited my last post with an image – CM.Dev May 13 '16 at 07:15
  • I know you did. I am saying that your command is wrong because your path is not correct. You forgot `\platform-tools` at the end of your path. – Programmer May 13 '16 at 07:17
  • Do `cd /d C:\AndroidSDK\sdk\platform-tools` – Programmer May 13 '16 at 07:17
  • Followed by `adb devices`. Post picture again. I can't see your screen so picture is what I use to see what you are doing wrong – Programmer May 13 '16 at 07:18
  • I had to refresh to see your last post. Ok that looks fine. – Programmer May 13 '16 at 07:20
  • @CM.Dev Ok. The image shows that your computer can see your phone. Back to Unity. Can you post the Adnroid build settings in unity again? – Programmer May 13 '16 at 07:23
  • Also do you have a memory card in your Android device? – Programmer May 13 '16 at 07:26
  • @CM.Dev yeah. I still need to see your build settings from unity to determine what to do next. Please zip the project that is not building. Close unity, zip it and upload to any website then link me there. I want to run it and see for my self. – Programmer May 13 '16 at 07:30
  • like what website would you suggest? – CM.Dev May 13 '16 at 07:33
  • @CM.Dev I know this is frustrating but we eliminated many possible reasons. Try http://www.wikisend.com/ Make sure your zipped file is under 100 Mbytes. – Programmer May 13 '16 at 07:34
  • well thanks for helping.. I think this lisnk should work but let me know if it doesn't http://www.filedropper.com/testempty – CM.Dev May 13 '16 at 07:37
  • @CM.Dev Downloading. Will notify you after testing on my android. – Programmer May 13 '16 at 07:40
  • @CM.Dev Tested the scene on my phone and it crashed. Created new scene and it crashed. Created a new project and it **DIDNT** crash. Can you create a new project and try this? Delete the current project. Create a new project. Let me know. – Programmer May 13 '16 at 08:15
  • so you were actually able to build and run with the usb cable, then? – CM.Dev May 13 '16 at 08:17
  • ok, I created a new empty project and did a build and run. I still have my phone off wireless and I tapped charge only when prompted - the build failed as before – CM.Dev May 13 '16 at 08:24
  • @CM.Dev ok I will give you an idea to try. 1. Uninstall your current Unity. 2. Download 5.4.0 Beta 13 from http://unity3d.com/unity/beta/archive. 3. Restart Android device. 4. Restart computer. 5. Create a **new** project and try it. That's the version I am using. I will be waiting. Please follow each step. Don't skip any. – Programmer May 13 '16 at 08:26
  • no, unfortunately that did not work... same error.. Ok, I think that the problem is most likely my phone. Over the course of the weekend I'm going to see who will lend me their android phone to test on. I thank you very much for your help and I will come back to post here what ever it is I find. – CM.Dev May 13 '16 at 08:52
  • @CM.Dev I suggest you do that Try another phone. Before you go, try one more thing. Delete apps in your device. Maybe it is running out of space. – Programmer May 13 '16 at 08:57
  • I actually just happened upon this question http://stackoverflow.com/questions/37018937/parsing-error-when-trying-to-play-cardboard-sdk-for-unity-demo-first-time It sounds a lot like the error I was getting on the phone side. So I looked for the said AndroidManifest.xml. It wasn't there in the empty projects that we created last night (I tried un-hiding all files). So, I went back to my cardboard demo project that I created in Unity 5.3.4 found the manifest file and changed the minimum and target sdks to match. It still wouldn't push through the usb. I side-loaded it .. IT WORKS!!! – CM.Dev May 13 '16 at 19:16
  • these are the screen shots http://imgur.com/a/ANQBb Now.. how do we go about organizing all this information so that people can understand what needs to happen so that their projects work? – CM.Dev May 13 '16 at 19:18
  • A few points: 1) Myself and the other poster were both on Android 4.1.2 2) I think taking the steps in your other answer was important too, specifically moving the sdk to a new folder on C and letting Unity update it to whatever is needed 3) Matching the paths in Unity External Tools and the API in in the sdk manager 4) Yes creating a new empty project deleting files and apps on the phone to create space just to make sure those aren't the problems – CM.Dev May 13 '16 at 19:24
  • @CM.Dev Ok good. In your question it says **I'm trying to simply build the Cardboard demo found here:** I guess that's the problem. The AndroidManifest.xml. was modified in that project by the person who made it. I really don't think that you have to modify the manifest after creating a new project. So simply creating a new scene should work. – Programmer May 14 '16 at 02:38
  • @CM.Dev Since it runs file now, did you manage to try the upload with another phone to see if the uploading problem is from your android device? – Programmer May 14 '16 at 02:41
  • not yet.. probably not till monday as I won't have access to another phone untill then.. will post more then – CM.Dev May 14 '16 at 23:14