0

I have 2 laptops. One is windows and one is Linux(Ubuntu). On the windows machine I'm unable to run android emulator app. I have tried with http://localhost/, http://10.0.2.2/ and none working. On Linux machine everything is work just fine. What can be the problem?

I have use Eclipse. And on machine localhost WAMP.

Update:

I have this code which I try to open via app. When I run it on my local i.e. http://localhost/file.php obviously I get this error for deprecated mysql_* function but the result is displayed (on the web host I don't get this errors). I've tried to turn of display_errors in php.ini and I notice that the app doesn't crash anymore and all is running. Is it really possible this to cause the problem?

<?php
$objConnect = mysql_connect("localhost","database","");
$objDB = mysql_select_db("tableName");

$strSQL = "SELECT * FROM res";
$objQuery = mysql_query($strSQL);
$intNumField = mysql_num_fields($objQuery);
$resultArray = array();
while($obResult = mysql_fetch_array($objQuery))
{
    $arrCol = array();
    for($i=0;$i<$intNumField;$i++)
    {
        $arrCol[mysql_field_name($objQuery,$i)] = $obResult[$i];
    }
    array_push($resultArray,$arrCol);
}

mysql_close($objConnect);
echo json_encode($resultArray);
?>
Goro
  • 499
  • 1
  • 13
  • 31
  • Windows is the problem. Assign a port number (9191) to the localhost and use `http://10.0.2.2:9191/` – Rohit5k2 Jan 20 '15 at 17:18
  • Still doesn't work. On windows machine so far work only if the address is remotely i.e internet host. – Goro Jan 20 '15 at 17:20
  • you will have to assign the post number to the server application in the localhost server (apache or IIS) – Rohit5k2 Jan 20 '15 at 17:22
  • Check out [this link](http://developer.android.com/tools/devices/emulator.html#networkaddresses) from [this SO answer](http://stackoverflow.com/a/5806384/1556245). – Shawn Erquhart Jan 20 '15 at 17:24
  • possible duplicate of [How to connect to my http://localhost web server from Android Emulator in Eclipse](http://stackoverflow.com/questions/5806220/how-to-connect-to-my-http-localhost-web-server-from-android-emulator-in-eclips) – Shawn Erquhart Jan 20 '15 at 17:25
  • I've tried already your suggestion @ShawnErquhart. First I found this link and tried before to post. – Goro Jan 20 '15 at 17:27
  • You should mention that in your question - I had no way of knowing that you had already tried everything that this article suggests. In fact, you don't say very much at all to help us help you. For instance, I'm assuming you're using Eclipse. Is that correct? – Shawn Erquhart Jan 20 '15 at 17:29
  • No apologies needed :) you're just less likely to get the answer you're looking for without a more thorough post. – Shawn Erquhart Jan 20 '15 at 17:31
  • Yes, Eclipse and WAMP. I have added this to question. – Goro Jan 20 '15 at 17:31
  • Have you tried shutting down WAMP before running the emulator? – Shawn Erquhart Jan 20 '15 at 17:32
  • No, you mean first to run emulator then the wamp? Just tried this also doesn't help. – Goro Jan 20 '15 at 17:36
  • Try running the emulator without WAMP running at all to determine if they're conflicting. If it works, then your issue is not accessing the emulator locally, it's accessing the emulator while wamp is running. – Shawn Erquhart Jan 20 '15 at 19:23
  • Yes, the problem was this old `mysql_*` extension. I've rewrite it to PDO and no problems now – Goro Jan 21 '15 at 16:55

0 Answers0