Unity apk not working - unity3d

I made a very simple game, adjusted player settings and external tools. switched platform to android. I can play my game with Unity remote on my phone.
When I build it's installed in phone, but when I launch app to start playing a black screen appears and then closes immediately.

I encountered the same problem as you did with identical logcat message.
If you haven't done so, you should uninstall Unity completely -> restart your computer -> reinstall Unity. That did it for me, hopefully, it works for you as well.

Related

Failed to start Vuforia on Unity UWP executable build

I'm trying to build a very simple UWP app (for PC Desktop only) with a single image target and camera using Vuforia on Unity.
Everything works fine in the Editor, but after I build and run the app I get the following error on a black screen :
I don't even know where to debug this, as the only log I get is this error and nothing else. I also tried delayed initialization, but this same behavior happens when I manually call VuforiaAppllication.Instance.Initialize(); after it's initialized and before it's started.
Here's my build settings :
I'm using Unity 2020.3.30f1 and Vuforia 10.2.5, the only target SDK installed on my system is 10.0.19041.0 and also, I have Visual Studio 2019 Community installed if that info helps.
Fixed by disabling my laptop's webcam from device manager, and connecting an external USB camera.

Direct deploy from unity to hololens emulator

Is there any way to direct install from unity to hololens emulator ?
I want to hit unity play button and hololens app get install and run on emulator.
Its very hard to for each test build unity project and then run built visual studio project on emulator.
I also used Mixed Reality Portal but it doesn't show real scales, scales are very smaller than hololens device.
You can try the Holographic Emulation feature provided by unity(https://docs.unity3d.com/560/Documentation/Manual/windowsholographic-emulation.html), and download the Holographic Remoting Player from the store in the simulator.
After successfully connecting to your simulator, you can run the Microsoft HoloLens project directly in the Unity editor rather than building and running the game each time you want to see the effects of the changes.

Freeze on Copying APK file

I created a new empty project, switched platform to Android and started Build and Run. But when it comes to "Copying APK File to device" it just freezes and I have to restart Unity.
I installed Android SDK & NDK tools just before that (through Unity Hub). Android Build Support was installed by me manually a while ago so it was visible as installed in Add Modules window. I did not do any changes to the project. The most interesting thing is that the apk is built in my Builds folder. Not sure if it works though.
I am using Unity 2019.1.0f2. The device Android version is 9.0 (API level 28) and the minimum API set in Player is 16, so the problem should not be with API.
Does anyone know possible reasons for it?
Try to turn off the following setting on your android device.
Settings -> Developer options -> Monitor apps installed by ADB
This setting(if turned on) will ask a verrification if you want to install the app. It feels like this cuts off the connection with unity which causes it to get stuck.
Unplugging and replugging the device seems to work aswell. In case of big projects this is anoying tho since if you are to quick it will just say it lost connection and it will ask if you want to reconnect, which in turn causes the same problem.
This is the only answer that worked for me:
https://answers.unity.com/questions/1248123/build-run-apk-freezes-on-pushing-content-only-one.html
In short, Player settings -> Publishing settings -> Split application binary
First of I would ask you on what computer did you run this on? (performance wise)
Second you can just copy the .apk file to the phone and install it there. If you got to where it prompts for copying to android your apk file is fine and built.

Can I use Unity remote with a Android emulator instead of Android phone?

Unity Remote is good app. It allows to connect with Unity while you are running your project in Play mode from the editor.
But what if I want to test game but I don't have an Android phone? Yes, it happens ¯\_(ツ)_/¯
I have a great Android emulator: Nox APP Player
The emulator doesn't have USB, so it just show me standsrt text Connect device with a USB cable ..... bla bla bla ...Game in the Unity Editor is running...emulator doesn't display the game.
Can I somehow connect this emulator to unity using Unity Remote? Or using something else? How?
Not sure if you still need the solution for this problem, but I think I should leave an solution for those who come later.
You can connect Nox with Unity via UnityRemote (I'm using Unity Remote 5) with the adb of Nox. Here the steps :
Rename your adb.exe to other (i.e adb_origin.exe). It's normally located at SDK folder\platform-tools
Go to Nox installation folder\bin, looking for nox_adb.exe, copy it to the location of your origin adb.exe
Rename nox_adb.exe to adb.exe
Open cmd and enter : adb.exe connect localhost:62001 and you will see "already connected to localhost:62001". If not, you can try replace localhost by 127.0.0.1
Then apply steps 3 → 7 of #Alexey
At the Resolution dropdown, you can choose Normal (default is Downsize) to have better image quality on Nox
Note that after all of this, you should restore the origin adb.exe for later use.
Here is my result picture :
Hope this will be useful.
Took from https://gamedev.stackexchange.com/a/126192/81175
I was able to run Unity Remote 4 on standard Android emulator.
Final effect looks something like
Whole procedure:
Install Unity and open some Unity tutorial project (2D Roguelike tutorial in my case)
Install JDK, Android SDK and setup Android emulator using AVD Manager.
My emulator config looks like this:
Important note: CPU/ABI option seems to be one of most important ones(Intel x86 emulator didn't work for me)
Then install Unity Remote 4 from apk file to emulator using command: adb.exe install path/to/apk (Windows) or adb install path/to/apk (Linux/Mac).
Then in Edit → Preferences → External Tools — set paths to Android SDK and JDK
In Edit → Project Settings → Editor in section Unity Remote select: Any Android Device.
In File → Build Settings — add Your scenes and switch platform to Android.
Press PLAY in Unity while Android Emulator is running and Unity Remote 4 app is opened.
Tip: At first I needed to restart unity after all changes, because it wasn't starting game on emulator. Now it runs everytime.
However, it works for AVD Manager emulators. I've tried them too, before I asked the question, and they didn't work because of CPU/ABI Intel x86 as #Axxxon said...now it works with CPU - ARM armeabi...
Unfortunately NOX APP PLayer doesn't connect. Maybe it because it's not have CPU/ABI settings. Or I just don't get how to launch this player with Unity.
It is said. Because NOX APP has touch simulating, screen shaking and other good stuff for checking game. AVD emulators doesn't have these things :'-( therefore they are useless for me.
But maybe this answer will help to someone.

Unity3D is crashing when hitting play – and when Oculus is on

I am using Unity 5.2.2f1 with the Oculus Rift and Windows 7. Everything was working well till... one hour ago. I first ran a build that played smoothly. I then moved away from my computer; when I came back, it was shutting down. Upon turning the computer back on, Unity started to crash anytime I hit play and the Oculus is on. If the Oculus is turned off before I start Unity, everything works perfectly. This is the link to the Unity Editor log.
This is part of the log, where the crash happens:
Completed reload, in 0.636 seconds
Initializing Unity.PackageManager (PackageManager) v5.2.2 for Unity v5.2.2f1
(...)
Native extension for OSXStandalone target not found
Native extension for WindowsStandalone target not found
Native extension for LinuxStandalone target not found
Native extension for WebGL target not found
Native extension for SamsungTV target not found
Native extension for Tizen target not found
Native extension for Android target not found
04/22/16 19:07:47: [CAPI] LibOVR module is located at C:\Windows\system32\LibOVRRT64_0_7.dll
(Filename: C:/buildslave/unity/build/Runtime/VR/Oculus/VRDeviceOculus.cpp Line: 46)
Crash!!!
SymInit: Symbol-SearchPath: 'C:/Program Files/Unity/Editor/Data/MonoEmbedRuntime;.;C:\Users\vcladmin\Documents\maze;C:\Program
(...)
#Programmer, I have used System Restore as you suggested.
The suggested restore point was at an install of "Dell update", right at the time of the crash. Proceeding with the restore, I realized that the NVIDIA driver was being restored from an old version (266), to the newer version (358) (that's the version I need to make the Oculus work). After the restore everything went back to normal. Then I tried to install Dropbox. After the install, the computer turned off again and, like before, once restarting, the Oculus was not working anymore. I checked the Oculus setup and it said it needed a new NVIDIA driver. So something is happening that makes the NVIDIA driver go from 358 to the old one. I don't understand why. What would you suggest?
A friend told me that probably the "Dell Command update" thinks that the new NVIDIA driver is the wrong one, so it restores it to the old one every time it updates. We have disabled automatic Dell Command updates.
Thanks for the help.