Debugger not attaching to UnityPlayer on Android Device - android

I have a game built on Unity running in an android device. In theory it should be possible to step through the unity code by attaching to AndroidPlayer at runtime.
Well I followed the rules on how to do this.
1) Created development build with script debugging enabled.
2) run the app with script debugging on wifi that has the player.
Initially it worked. Then perhaps a change or two in my network, and I no longer see AndroidPlayer as an option in MonoIDE to attach to. Its vanished and for several days now I am not able to debug. Not only that but i really don't know where to check this. I yanked out the ethernet cable so device and Mac are both on same wifi running on single subnet. Nothing seems to help. But what really dissappoints me is there is really nothing to check in Unity when this type of thing happens. It just try to attach to proess. Hope AndroidPlayer process is there and if its not. Tough luck.
PS: I should add I am on Unity Pro 4.2.04f. It worked fine, then who knows what and it stopped finding the AndroidPlayer. What a mess!
PS: Things I have tried. Pinging to ip address, and telneting to port (successfully to ip:5555)
Note: This is not the Android Debugger I am talking about but a player that needs to be running in the app, and visible to MonoIDE in order to debug.
What I am really trying to understand is what are my options when I cannot see AndroidPlayer as an process to attach to?How does one debug this problem? Are there things in the logg if AndroidPlayer is sucessfully running? How could monodebug not see it? How do I know it it is or is not running on the devices.
Thanks

Have you looked at the IP address of the Android device and attempted to ping it? I find that, here in the UK, our BT provided "home hub" will often, randomly, stop routing traffic between devices on the same network.
I find that if I can't debug (and I believe Unity 4.2 still used wifi debugging) then I usually can't print either and it's because the router has stopped routing traffic.
A quick reboot of the router usually fixes it.
PS Just read about the ping being successful. Have you downloaded and run "wireshark" to see what network traffic is happening? At least that will show you what is happening on the network layer.
Other thought, any sort of firewall running on the debugging machine?

Try to:
1) Disable antivirus
2) Disable firewall
3) Deinstall Xamarin (in case when you use VS for debugging)
That did help me when I had the same problem

Related

Newbie - adb_vendor_keys issue on dji android device

Been browsing this group, found some great answers on here, but none have helped me with my problem.
We have a new ( less than 1 month old) dji device, called a smart controller, it’s basically an android tablet, it’s built into our drone remote controller.
A few days ago it came up wirh an error message duijg # Flight, which was basically a memory overflow.
So we suspect the internal memory has been filled by the local cache files.
The issue is that this has now stopped the device even starting up.
We have tried installing drivers on our pc, including the firmware update application from dji, but this just fails every time we try it.
Today we have been following advice on here, and using Rhe ADB program on our pc, we do at least get a connection to the device.
However we can’t do anything withnht program.
Each time we try any command we get this message
Device unauthorised
This adb server $adb_vendor_keys is not set.
We have tried deleting the public key, on the pc, and creating a new one, but we can’t write that new key to the device.
We are not programmers and don’t know code, so we are doing all this on our pc in a command line prompt.
Before we give up and send it back to China, anyone got any ideas on what we might be able to do?
Thanks in advance.
Without being able the use the physical device. I do not believe there is anything that you can do. Generally speaking the error you are seeing is caused due to a permission prompt that would appear on the device authorizing your computer to interact with it.
If you could get the device to display and disable and re-enable usb debugging a security prompt should display when you connect it to your PC. Without that option I would recommend sending it back

I can not access my notebook with my Android using IPv4

I'm having a bad problem and it already gave me a headache. I did an application with Magic Software and to run it on my Android I have to configure Magic Studio the right way (done), run the project on the Magic server (done and working) and install MagicDev.apk on android (available in the Magic XPA folder and already done), and when finished installing, the application must be run and when it is executed it asks to enter the URL of the Magic application, which is the following: http://[IPv4_of_notebook]/MagicScripts/DevProps.txt, but when you try to access this, it is not possible, it says that the application was not found or the connection failed.
It is worth mentioning, I had this same access problem when using XAMPP or Wamp, because when trying to access the localhost with the cell phone, the link would not respond, it would load until I gave the message (I put Wamp online for this, of course, and changed the settings in the [files].conf). Another important thing is that I made an Android application in Android Studio where one of its functions was to access the internet and although the application installed on Android really could not connect to the link, the emulator accessed quietly (the emulator runs inside the pc, would there be anything?) and I could do what I had to do, this link was on a page I made using Wamp, that is, the emulator accessed my IP, and the cell phone can not.
My question: Is this some configuration of the notebook, Android, Internet router or am I doing something wrong? My friend created a page using Wamp, configured it correctly and placed it online and from my home, with his IP, I accessed the page (with my notebook) in a quiet way. One more note, my notebook connects to the internet with Wifi and my Android too, meaning they are not connected to the source directly as my room PC is, and I do not know if that also matters.
I will later try to run the application on my PC from the room and see if it gives him access to his IPv4, but I do not think it will work either. Anyway, does anyone have any idea what it can be? I do not like messing with my notebook's Internet and other settings without knowing what I'm actually doing, I'm afraid to make my notebook vulnerable. Here in this video https://www.youtube.com/watch?v=1njzFq07t2U you can see the process I'm describing here, but it's not working for me.
I already figured out the villain, it was the firewall. When I turned it off everything worked as expected. I can not keep it turned off for security reasons, but from what I've seen I can configure it to accept only my phone.

Android debugger continually disconnects

I have never had an issue debugging in Android until I switched to my current workspace. It happens in both Eclipse and IntelliJ. Previously I had an issue where the phone would hang at the "Waiting to attach debugger" dialog. Somehow I fixed that so the debugger at least attaches to my app.
Now I can set a breakpoint and have the debugger stop at that point. After about 5-10 seconds it disconnects no matter what I do. I'm able to read a few values of variables in memory before everything disappears. My co-worker is able to debug the same app just fine using Eclipse and we haven't been able to figure out what is wrong or different between our workstations (besides me using IntelliJ). We might have different images for our laptops though.
Any ideas? I've had to use Log statements for now but they are just too slow compared to using an actual debugger. I've tried using different USB cables and that didn't make much of a difference. I've gone through the debugger settings and nothing seemed out of the ordinary. Other Q/A's on SO have mentioned the app silently crashing, but I'm ruling that out due to it debugging fine for my co-worker.
I've been having the same problem running IntelliJ IDEA build IC-133.193. I solved the problem with the following actions:
Quit IntelliJ
From a command line kill the adb server with adb kill-server
From a command start the adb server as superuser with sudo adb start-server
Restart IntelliJ
IntelliJ will start the adb server if it detects that it is not running. The key appears to be starting adb as superuser before starting IntelliJ.
[Update] This doesn't always work. The best solution I've found is to start the app on the device and then attach the debugger to the Android process through the Run menu. I haven't had any disconnections using this method.
I have been fighting for a few days with adb not seeing my device. After trying many other posted solutions, I discovered that the issue was with Chrome also trying to connect its debugger to a web view. If Chrome is connected using chrome://inspect, then adb seems to disconnect. Quitting Chrome resolves the issue. Then I can connect with Android Studio and then restart Chrome and reconnect. Hope this helps someone else.
This fixed it for me
Go to Power Options on your computer
Click 'Change plan setting' on your chosen plan.
Click 'Change advanced power setting' on your chosen plan.
Expand 'USB Settings' .
Expand 'USB selective suspend setting' and change it to disabled.
This issue occurs to me when I try to use a USB 3.0 port. Using a USB 2.0 it does not happen.
This happens to me when the cable connection is sensitive.

multi-touch support for Android emulator, programmatically

From latest SDK, multi-touch is supported via tethered phone. I'm wondering whether it is supported programmatically. In other words, can we test multi-touch triggered functionalities using automated test suites?
No it's not. but from sdk-r20 you can use multitouch in emulator with a real phone connected to computer. check this out.
I'm working on this same problem. First I'm tested to make sure all tethered signals are going through (I had to modify the SDkController app to even get the connection). Now I'm trying to figure out why, when I click the side of the screen or anywhere, it only shows up on the top right (while the debugger from the emulator is giving the correct thing). The error is explained here.
I did however figure out how to do it wirelessly and through the terminal. If that is what you're asking the procedure is pretty much the same. You need to root your device or do the adb port command (with USB connected) before un-connecting your device, and it'll work wirelessly.

how to run wifi peer to peer application in android emulator..?

I am trying to develop an wifi peer to peer application in android(4.+).
The problem here is how to test it.
I tried to run that application in android emulator. there was no option to configure wifi in the settings menu, i also tired to enable wifi using the dev tools application form the emulator but it didn't work, And through all my googling over 3 days and i found that Android emulator is not supported the Wifi.
So i opted for androidx86 4.0eeepc using virtual box and tired to add devices both wifi and bluetooth (my app uses both bluetooth and wifi) but only bluetooth device got added and it did not work. But my virtual box detected the wifi and bluetooth devices. I just couldnt get them work with the virtual machine.
I tried everything like manually adding the addresses using terminal emulator app in androidx86 and used netcfg through the android commandline but neither of them worked.
Please suggest and guide me on the correct path to run these kind of applications that use wifi and bluetooth in android.
Thanks in advance.
First, be sure you enabled WiFi Direct in the Android settings for the two virtualbox instances:
Settings --> Wireless & Networks --> More... --> Wi-Fi direct
It has been stated as working once that hurdle was overcome, and I'm sure many have experienced the same...just be sure to enable wifi direct
I would have tried exactly what you've already tried by naturally moving from the emulator to the androidx86 project. Although unreliable, I'd recommend looking at and finagling this, if you haven't yet seen it: Android: Simulate WiFi in the emulator? and How to disable/enable network, switch to Wifi in Android emulator? most likely wouldn't have full out success but may be enough to let you know that it works or would work.
As far as testing WiFi-Direct/WiFiP2P without you yourself having a device/s, I would recommend:
Trying out some of the fiddling as mentioned above. And read through tons of logs.
You could always crowd source it to friends, or release an apk on a forum for a small group of testers.
Of course, both of those options are not ideal, seamless, or fast. So, I'd definitely hope you get VirtualBox VMs of AndroidX86 4.0 running as it should once you check that setting and pair up the WiFi APs :-)
A near future solution:
This might be something to look into in near future.
Real devices are hosted by Samsung and screens are streamed to your PC.
http://developer.samsung.com/remoteTestLab.do
According to an email responded by samsung, which I sent to them earlier.
They only have 2 devices (Galaxy Nexus) running on Android v4.0 at the moment.
Unfortunately they are not physically close to each other. (One in Korea, One in Poland)
But they are planning to upgrade existing Galaxy S2 to v4.0.
Because recently Samsung have released v4.0 upgrade for S2.
Once they done that, there will be plenty of v4.0 phones.
And you can ask them which 2 phones are physically close so you can test Wifi Direct.
--------------------------- EDIT ---------------------------------
There are plenty of ICS devices there now, which you can test P2P.
Check with them which 2 are physically near to each other.
Per the docs:
Each instance of the emulator runs behind a virtual router/firewall
service that isolates it from your development machine's network
interfaces and settings and from the internet.
You have to use Network Redirection, as described in the Developer Docs. In essence, you forward specific ports using ADB. Therefore you cannot test certain things like broadcast messages.
I have tried doing what you are trying to do, and-- while I won't say it is impossible (anything is possible in computing with enough time, money, and persistence)-- I wasted a lot of time on it. You cannot treat the Android emulator as a normal network peer-to-peer device. As far as I have been able to find, it is a fork of QEMU, and that is just how the QEMU emulator is implemented.
QEMU itself does support TUN/TAP bridging, but I was never able to get it working with the Android emulator. If you want to go that route, you may want to investigate running Android in the QEMU emulator, rather than in the SDK's emulator (I see you are already trying a similar approach with VirtualBox).
Unfortunately the best way to test a peer-to-peer networking program in Android is with physical devices at this time-- unless your app can suffice with the port forwarding method.
See Also: Issue 26:Emulated Androids should be able to communicate via TCP, and Google
(Repeating here my answer elsewhere.)
In theory, linux (the kernel underlying android) has mac80211_hwsim driver, which simulates WiFi. It can be used to set up several WiFi devices (an acces point, and another WiFi device, and so on), which would make up a WiFi network.
It's useful for testing WiFi programs under linux. Possibly, even under user-mode linux or other isolated virtual "boxes" with linux.
In theory, this driver could be used for tests in the android systems where you don't have a real WiFi device (or don't want to use it), and also in some kind of android emulators. Perhaps, one can manage to use this driver in android-x86, or--for testing--in android-x86 run in VirtualBox.

Categories

Resources