Mobile Device Testing and Debugging with VirtualBox, Android Studio, Visual Studio and IIS

This post is from the perspective of a person who has a Microsoft technologies based web solution that needs to connect with a mobile device. This might work for other types of technologies and virtual machines with some or alot of tuning. Basic principles should be more or less the same.

I will give firstly an introduction on the solution used in my scenario:

I have a Android mobile device with an app in it that needs to connect to a webapi service to retrieve data and post data to it. The thing which this post is concerned about, is debugging the app with Android studio using the app from the Android device against a webapi which is also under debug mode in Visual Studio. This way I can see what is happening both on the client and on the server side.

Basically how this works is that you will have to connect with your mobile device to a local network where your physical machine exists. Because you are using a mobile device the logical way is over WiFi and no having your device plugged in to your physical machine by USB does not work. You can not directly connect to a localhost that way. Well atleast I could not make it to work. Notice that you can connect to a localhost from Android Studio while debugging your Android app but this is only possible is your a emulating the app locally. Even then though you might have problems and have to configure your solution in such a way that your app will pick it up.

This post assumes that you have a ready build for your server side solution at a location in your development machine. Here are the steps:

1. Create IIS site

– Add a new application to IIS which points to your solution build location.
mobile1

mobile2

– Next make sure that the application pool account has enough privileges to the location. I do this by creating a new account to AD or I create a local machine account on my development machine.

This is to configure the Application Pool account:
mobile8

These steps are for the file system level:
mobile3

mobile4

– If you are using a database in your application make sure that the application pool account has the proper privileges. This depends of course on how you have built your solution.
– Assign a port to your web application

mobile6

mobile5

2. Config ports and firewall settings
– Next you need to allow inbound and outbound connections to you web application through the port which was earlier configured for the web application. This needs to be done for both the virtual machine and your actual physical machine.

For virtualBox:
mobile9

For WMWare:
mobile10
mobile11

3. Attach to process

The next steps is to attach your developer tools to your server solution and your mobile application to whatever developer tools your are using, something like Android Studio or XCode.

Config VirtualBox

How to Forward Ports to a Virtual Machine and Use It as a Server

 

Advertisements

Apple’s Swift language not ready for production use?

I’ve been playing around with Swift for a few months now and have been happy with the language and making applications with it BUT there where problems, bugs and annoying crashes while developing with Swift and XCode. During the Beta phases this was OK but now that the XCode 6.0 is out as non Beta some of the same bugs still exists and for me two bugs are the most annoying and a show stopper which keeps me from not using Swift with iOS development up until Swift and XCode matures and the bugs are Fixed.

The two most annoying bugs are:

  • XCode “intellisense” and indexing crashing once application and code complexity evolves
  • Swift compiler bugs where you are forced to clean your development environment or create a new development environment from scratch because XCode and Swift compiler refuse to compile your code citing to illogical errors that are not there. This was a big show stopper since the code had no syntax errors and would compile on another Mac OS development image.

Long story short once my application grew in size, functionality and complexity Swift and XCode started to fall apart forcing me to state that I have to move to other languages and frameworks to do what I need to do for the application to work. As a developer nothing is more annoying than tools that do not work and make you use hours upon hours to fix or go around the issues.

Others seem to feel the same way:

http://2359media.com/developers-insight-swift-is-not-ready-for-production-code/

 

It’s a shame, Swift looks promising but for now it is best to stay away in anything else than small projects and testing of new functionality.