Sunday, December 29, 2013

Connecting your Android phone to your Windows WiFi HotSpot

Now this actually something I thought would be a piece of cake, until the day I actually wanted to do it.

This is how I tried:

I went to 'Network and Sharing Center' and selected 'Set up a Connection or Network' and clicked on 'Set up a wireless ad hoc (computer-to-computer) network'.


Then gave the following details.



Windows said my network is ready to use but it was not showing up on my Android phone.

Googled a bit, and got the bad news. Android does not support WiFi ad hoc networks! Well at least if your phone is not rooted. In my case I was trying with a Nexus running Vanilla Android. Doh!

Again, Google to the rescue. I found out that we can use 'netsh' administrative commands to host a wireless network in the access point mode instead of the ad hoc mode.

So on an administrative command prompt, you type:
netsh wlan set hostednetwork mode=allow ssid=MyAdHocNetwork
key=12345678



Then you start it:
netsh wlan start hostednetwork



Now you will see 'MyAdHocNetwork' in your Android phone's WiFi networks list!

PS: Later I found out this can be done with ease using 'Virtual Router Plus', but it doesn't hurt to get a little grease under the nails once in a while :)

Android Studio: How to refer an external library (.jar)

I had quite a bit of trouble doing this, hence thought of blogging it.

First you need to download the required .jar file. In my case it is 'commons-codec-1.9.jar'.

Then create a folder named 'lib' in your project folder and copy the .jar file.

From Android Studio, right click the lib file and select 'Add as Library...'.



Select your project and confirm.


Open 'build.gradle' of your project and add line 'the following line under 'dependencies':
compile files('libs/commons-codec-1.9.jar')



Add code to use the referenced library.



Rebuild your project.



That's it! :)

Sunday, December 22, 2013

Android Studio: New Project Wizard Weird Blank Error Resolution

Recently I bought a new laptop and had to install all my software from scratch. Everything worked fine but I just couldn't get the Android Studio working. Whenever I tried to complete the New Project Wizard, it backed off throwing the following blank error message.


I tried re-installing the Studio, JDK, trying various setup configurations, typical restarts and whatnot but this was not going away. Surprisingly the samples which comes with SDK seem to load fine. Therefore I tried to copy one sample project folder to my working folder and thought of changing everything to suit my new project. Kaboom! The error came back!!!

Then only I checked whether my working folder path is to blame...


Zoomed...


Damn it! That single quotation mark is screwing things up all this time. Shame on you Android Studio. It's almost 2014 and still you cannot sanitize user inputs? So I changed my working directory and all went fine just like the old days :) Hope this post will help someone someday who is splitting hair across this stupid error. Peace out!


Touchpad not working on CloudReady / Chrome OS? Here's how to fix it!

Covid-19 break seems to be opening up interesting avenues for me. I started a storeroom cleanup activity and I found an old laptop which I s...