Attaching Unity's integrated profiler to Mobile Devices - profiling

Has anyone successfully used the Unity profiler with a physical mobile device? (i.e. the Unity 3.4 IDE tool that provides real-time stats on Unity calls, not the iOS or Android internal profilers). And if so, can you post the details about your setup and your experience?
I'm starting to get the feeling that people aren't using the profiler to test their games on real devices, given how little I can find in the Unity documentation and forums or on the web in general. In particular, dreamora is the only person I have heard of who has successfully attached the Unity profiler to a real device running a game (and then, only on iPhone not Android). It is also suspicious to me that the Android remote tool for Unity 3.4 which I downloaded form the marketplace requires a cable to connect to the Unity IDE and doesn't seem to have a wireless option; I see this as a red flag that wireless profiling by attaching the Unity profiler to an Android device may be impossible (please correct me someone if I'm wrong).
I would like to know your experiences (good or bad) with this tool, and assuming you have been able to profile a device, specifically I would like to know:
1) Did you connect to and Android or iOS?
2) What device and API version (i.e. Nexus S1 AndroidAPI=2.3.7 Kernel=2.6.35.14 running Cyanogen MOD 7.10)
3) What type of computer are you using (Windows or Mac, and OS)?
4) What is the nature of the connection you were able to make between your computer and the device?
4.1) Wired or wireless?
4.2) If wireless, ad-hoc from computer to device, tethering from device to computer, or both connected to the same WLAN router?
4.3) If wireless, what is the setup (DHCP, Static IP, ttl=4, etc?)
5) What are the Unity build settings (i.e. Development Build checked/unchecked, Autoconnect Profiler checked/unchecked, etc?)
6) What were the specific steps you took to connect to the device? (i.e. Build and run on device, then restart Unity twice, then offer up a prayer to the gods by sacrificing a Symbian phone, then connect via the Active Profiler pull-down, etc.)
Let's get to the bottom of this together, I will repost any information this community can provide me with in the Unity forums as well.

Well, I am going to partially answer my own questions here: By following these steps I was able to connect to and profile my Android Nexus running the Cyanogen Mod (7.1) using my MacBook pro (running 10.6.8 "Snow Leopard") on both Unity 3.4.1 and 3.4.2:
Create a WiFi Hotspot using Internet sharing on your Mac. Use the "Share your connection from: Ethernet" and "To computers using AirPort (AirMac)" options. I did not password protect my network.
Connect to this the WiFi network on your Android.
Quit Unity.app (if you already launched it).
Disable the Ethernet interface under System Preferences -> Network (select 'Off' from the Configure IPv4 pull-down menu)
Launch Unity.app
Enable Ethernet interface under System Preferences -> Network (select 'Using DHCP' from the Configure IPv4 pull-down menu)
Now Your Android should be in the list of the Profiler window. Of course, you will need to launch a Unity application that was built with the 'Development Build' and 'Autoconnect Profiler' checkboxes selected under Build Settings (that's what I did at least).
Happy Hunting!
-Arun

If the above don't work or you need to profile specifically on a Windows Phone, try the following...
1.) Make sure in Build Settings you set it to 'Development Build'.
2.) Connect your phone to your Wifi Network, then click on the wifi connection to see your phone's IP address
3.) Enter the phone's IP address in the profiler, and press the 'Record' button and the profiler will begin profiling on your phone.
4.) Run your game from Visual Studio, wait and you will see the profiling will begin.
If you don't see your phone in the profiler, try this alternate method
1.) Connect the phone to your PC
2.) Make sure in Build Settings you set it to 'Development Build'.
3.) Build the game to Visual Studio
4.) Run the game in 'Debug' mode from Visual Studio
5.) When the game is running on the device and is past any loading screens, click on the 'Active Profiler' dropdown in the profiler, and the device should be listed there

Related

ERROR: x86 emulation currently requires hardware acceleration!` in android studio on google cloud virtual machine

Currently new to google cloud
and working on vm.
Can anyone help me how can i use android emulator on vm.
it shows me
Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration!
now how can i enable hardware acceleration on vm??
First of all you can not access BIOS on Google Compute Engine VM. When you restart the instance you will be automatically disconnected from the SSH session. As soon as you open another SSH session again you will be already logged in to the os.
Android Studio Emulator is another Virtual Machine that emulates the operation of an Android device. So what you are looking for is VM nested inside a Google Compute Engine VM, you can refer to the Enabling Nested Virtualization for VM Instances documentation, for further information.
However, you can use arm64-v8a or armeabi-v7a ABI. They are pretty slow but you will be able to test your applications there. You can make them faster, but it will require a powerful VM that will cost a lot of money. To use those images in Android Studio emulator:
Go to Tools > AVD Manager.
On the bottom left corner click on + Create Virtual Device ....
In Choose a device definition, choose any device you want and click Next
In Select a system image go to Other images tab
Choose any arm64-v8a or armeabi-v7a ABI. (Download if you don't have one)
Click on Next, give a name and click Finish
Run the Virtual Device and give it some time, according to how powerful is your VM it will take some time to load. You will see an Android logo loading and after few minutes you will see the Home Screen. If it takes too long, try restarting the AVD and the Android Studio, then leave it some time to load. It is pretty slow, but it is working, I tested it myself.
Try below steps -
Open SDK Manager (In Android Studio, go to Tools > Android > SDK Manager) and Download Intel x86 Emulator Accelerator (HAXM installer) if you haven't.
Now go to your SDK directory C:\users\%USERNAME%\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\ and run the file named intelhaxm-android.exe.
In case you get an error like "Intel virtualization technology (vt, vt-x) is not enabled". Go to your BIOS settings and enable Hardware Virtualization.
Restart Android Studio and then try to start the AVD again.

Connectivity problems with Glass

I've created a small Glass app and am trying to help someone else side load the .apk file directly on on their Glass as part of internal testing. I had them install the Eclipse + ADT Bundle, run the SDK Manager, etc (i.e. the basic instructions from here). They verified that the Google USB driver does show up in the SDK Manager.
With the device plugged in, running "adb wait-for-device" hangs. So it doesn't appear device communication is working. The device also does not show up in DDMS in Eclipse.
They verified that USB debugging is enabled on the Glass itself under settings.
I also tried having them follow the instructions here but this also did not help. They are able to see the Glass removable storage device in windows.
Any suggestions on what else to try? I do recall that with my Glass device at one point I put it on and it asked me if I wanted to allow debugging from the computer where it was plugged in. I'm not sure if this could be a roadblock here or not but I'm also not sure how to get to that prompt.
Once you get the correct values into android_winusb.inf it works fine, see
Google Glass ADB devices doesn't find. OMAP4430 driver not installed (can't find it!)
Here's an example on a Win7 box:
(edited to include screen capture)
The easiest workaround is to find a Mac, Chromebook or Linux computer. Windows with ADB and Glass is nothing but pain.

Unable to connect to Google Glass on Windows 7 (using ADT)

Environment:
OS: Windows 7 Ultimate 64-bit, SP1 (latest patches)
Hardware: Dell XPS L702X (8GB Ram)
Android Developers Tool (ADT): version adt-bundle-windows-x86_64-20131030
Google USB driver: version 9
Google Glass: "v2" device running XE12
Situation: Debug mode enabled on Google Glass; connected to USB port on computer; no device seen (ADT cannot find glass).
The android_winusb information already contains the following settings for Glass: in NTx86 section:
;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01
in NTamd64 section
;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01
Update: When I open the device manager, I DO see the "Glass 1" device in the "Portable Devices" section and in "Other devices" session. However, when I open the ADT the Google Glass device is not recognized (even though when I connect my HTC One Kit Kat 4 device shows up, is recognized and I can load an application onto that Android phone).
Suggestions on how to resolve?
Finally able to connect with Google Glass! Here are the steps that I used for the environment in question:
Installed ADT bundle for 64-bit Windows; updated all (took more than one cycle)
Used Android SDK Manager to load API 19 (Kit Kat) and API 15, along with Google Glass Sneak Peak, and ensured current USB driver was updated (to version 9 at this writing)
In ADT, added MyFirstApp (for Android phone) and deployed to HTC One/Sprint (running Kit Kat) device [optional, just to ensure that ADT can recognize something]
Stopped ADT
Opened Device Manager
Connected Google Glass, noted "Glass 1" in BOTH the Portable device and the Other device sections
Selected "Glass 1" in the Other device section (not the Portable device section) and ran update driver command pointing to the xxx\GoogleGlass\adt-bundle\sdk\extras folder to search.
Completion of driver update moved the device to "Android devices" section, noting it is an Android Composite ADB Interface
Once this had completed, I could take a sample application (I used Compass) and ran it as an Android Application!
(Since my device has an automaatic lock -- I assume -- I had to power cycle the device once to be able to get it to respond.)
I had the same issue. Glass was showing as SAMSUNG Android phone as well. My steps to fix the issue:
win7:
Click on: Update Driver
Click on: Browse my computer for driver software
Click on: Let me pick from a list of device drivers on my computer
Click on: Have Disk... (that options is in the bottom right corner)
click on: Browse...
navigate to the location of your edited android_winusb.inf driver then click open then click ok then click next
wait a moment then you should see "Windows has successfully updated your driver software". then click close and close again.
!!!(now here is the important part)!!!
Right click on the device and click uninstall.
check the box "Delete the driver software for the device" then click ok
wait about 5 sec then unplug your Google Glass from the computer. wait 5 more sec then plug it in.
Watch the magic happen!!!! its working!!

How to disable WiFi on Glass for testing?

I want to develop a receiver for Google Glass which will detect the WiFi state of Glass and depending on that state show some information to user.
The receiver will listen for android.net.wifi.WIFI_STATE_CHANGED so that I can catch the event and after that check the status of the internet. It will not only detect the internet availability but will also show if Glass is timing out when pinging any specific IP address from any apps of glass.
I have tested the receiver on another Android device and it's working fine. But now I want to test the app on Glass. In order to test, I want to disable WiFi; however, Glass only shows options in settings for forgetting the current WiFi network and connecting to a nearby network.
How can I disable WiFi on Glass temporarily?
From default settings of glass its not possible to disable WiFi. To do the things you have to follow some instructions and install android default launcher and settings so that you can get the settings UI as your android device and do the rest of the desire works.
I am describing the whole process here :
At first you have to download these two apk.
Settings.apk - http://goo.gl/EqV8u
Launcher2.apk - http://goo.gl/ytfSn
After that you have to install these two apps into your glass by ADB :
1. adb install Settings.apk 2. adb install Launcher2.apk
Please be careful not to check the “Use as Default” box or you will not be able to access your Glass Settings until you uninstall Launcher2.apk.
After complete installing go to your settings and select launcher. After selecting android default launcher you will get the setting UI as like as your android device. Now you can do whatever you want like WiFi enable/disable, Bluetooth enable/disable and etc. But there have some issues which not working like Bluetooth Tethering, Data Usage , Airplane Mode and some more features.
Details process of using the settings and launcher and not working features.
If you want to uninstall the installed app at first see your app packages name and delete the app from the devices using below script :
adb shell pm list packages [see all of your installed app list]
abd shell pm uninstall -k com.packagename [your app by specific package name]
After above script you will get your previous glass settings.
Here is the excellent video where all these process has been described in nice way.
Voiding Your Warranty: Hacking Glass
Well as you already know we cannot disable/enable wifi and bluetooth through the native settings application(and I really don't know why). But what we know is that Google Glasses is a bit special Android device on which we can do a lot of stuff that can be done on a regular android device(such as a phone). Among "the stuffs" that can be done is enabling/disabling wifi and bluetooth programatically! In order to do that you must create your own small project and include the following lines:
WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);
wifiManager.setWifiEnabled(false);
boolean wifiEnabled = wifiManager.isWifiEnabled();
//Disable bluetooth
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.disable();
}
after running your small application that disables wifi and bluetooth you can navigate to your glass settings and see that both wifi and bluetooth are OFF. If you access one of them it asks you to turn them back on. At least it works for Google Glass 19.1 (this is my current version).
I made an app that should let you toggle wifi on and off right from the menu.
Either say "okay glass, power options" or navigate to the card under the "okay glass" menu structure.
Working on bluetooth for later. Based the app on the link below.
my app
https://github.com/afzaman/Power-Options-GoogleGlass
resources:
http://javatechig.com/android/how-to-turn-off-turn-on-wifi-in-android-using-code

Win Mobile 5.0 Can't Debug and user WiFi

I have an app that I have to debug. It is C++ on Windows Mobile 5.0, and it uses a network connection via WiFi. (Visual Studio 2008.)
Disconnected from USB and active sync the app connects to the network just fine, but as soon as I plug it into the cradle, (and consequently connect via ActiveSync) it automatically disables the WiFi network, and I can't seem to find anyway to turn it back on.
I need ActiveSync to control the program in the debugger, and I need WiFi to have the application run, but I seem to only be able to have one or the other.
Does anyone have any ideas? Please save me from having to resort to debugging via printf statements :-)
Don't use ActiveSync - debug directly through the WiFi connection.
I've recently been having reliable fortune debugging over WiFi. The magic seems to be configuring the device's transport IP address and using ActiveSync to jump-start the process.
(I'm using Visual Studio 2008 on a Windows 7 (x64) system; and a Windows Mobile 6.5 device, in case it matters.)
Start up copying the five files listed below unto the mobile device.
Make sure your WiFi is connected and your WM device had a valid IP.
Inside Visual Studio, select Tools .. Options .. Device Tools; then select Devices
Select the "Device" you want to debug; I used "Windows Mobile 6.5.3 Professional Device"
Properties
The Transport should be "TCP Connect Transport", click Configure.
Select "Use a specific IP address" and enter the address.
Exit the dialogs
Connect the WM device via ActiveSync; connect the project to the device within Visual Studio and run it (inside the VS debugger).
Exit the application, waiting to make sure the debugger completes normally.
Disconnect the device from the USB ActiveSync connection.
Run CMAccept (see below) on the mobile device
Run the debugger. (Don't wait to long, because there might a time-window.)
With any luck, the app will start just as if it were still connected to ActiveSync. You can even compile and deploy updated files without needing to reconnect ActiveSync.
First time this worked, I think my jaw hit the ground; I stumbled upon it by chance and simply couldn't believe it was working.
[Debugging on CE5.0 device without ActiveSync] discusses this for Visual Studio 2005 beta2; it seems to be relevant. (This link is also cited in another answer to this question).
The instructions include copying 5 files from host \Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\<CPU> to \windows on the device.
I copied the 5 files from \Program Files (x86)\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\armv4 to \VSDebugFiles on my device (expecting to experiment with them). What I did find was that, if Visual Studio refused to connect following the above steps, running CMAccept on the device would help.
In case the link is ever removed, the five files are:
clientshutdown.exe
CMAccept.exe
eDbgTL.dll
CommanClient2.exe
TcpConnectionA.dll
Ok, I admit that this is still very hit or miss, but it is hitting more often than not.
If you don't have a convenient way to check your device's IP, try VxUtil; it's my go-to network utility for validating Windows Mobile network connections.
Good luck, hope it works.