Android Question B4A in Mac AVD Emulator?

nicieri

Active Member
Licensed User
Longtime User
Hi, I have a mac with Parallels. In Windows the AVD Emulator is too slow, I prefer the AVD Emulator running on my Mac (very fast). Reason of my Question: The ADV Performance is much better in OSX.

The Question is.. How Can I connect the B4A of my Windows to the AVD Emulator on my Mac?
(maybe like a B4i on Windows with iPhone emulator on Mac)

Is possible?, I was traying installing B4A Bridge on the Emulator but.. the problem is that the B4A Bridge detects: "My IP: Not Connected to the Wireless Network"

For the command line I know that the Emulator IP is 10.0.2.15, The Ip of my Mac is 192.168.15.4

I also tried to put some of this IP in B4a Menu... B4A Bridge > Connect > New IP

But not connect.

Any Idea?
 

nicieri

Active Member
Licensed User
Longtime User
I have It!

This is the Answer:

On the configuration of VW Windows of Parallels, we need to put the Netwrok Type: "Shared Network"

OSX

Because you will be setting up an SSH tunnel, you will need to enable SSH logins for your Mac. Start the Settings app then go to Sharing and Check Remote Login.


Download plink from the Putty website and place it in a folder.

Next, you will create two scripts. The scripts will shut down the "Android Debug Bridge (adb)" if it is running and setup an SSH tunnel from Windows to OSX.
  1. For the first script, create a new file in this same folder called "connect-to-mac.cmd" and copy the following script into the file.



    @echo off
    adb.exe kill-server
    plink -L 5554:localhost:5554 -L 5555:localhost:5555 -m mac-script.sh -l johndoe123 -pw johnspassword johnsmac.microsoft.com

  2. In the preceding script, replace:
    • "jondoe123" with your Mac user name

    • "johnspassword" with your Mac password

    • "johnsmac.microsoft.com" with either the IP address or the host name of your Mac
  3. For the second script, create another file in this same folder called “mac-script.sh” and copy the following script into the file:



    #!/bin/sh
    ~/Documents/android-sdk-macosx/platform-tools/adb kill-server
    read -p "Press any key to terminate SSH tunnel" anykey

  4. In the preceding script, replace "~/Documents/android-sdk-macosx" with the location where you unzipped the Android SDK.

    Windows is now configured and ready to go.

Follow these instructions each time you startup your Mac and Parallels.

To run the emulator
  1. In OSX, open the Terminal app and type:



    ~/Documents/android-sdk-macosx/tools/android avd

  2. Use the AVD Manager to start the Android emulator that you want to use.

  3. On Windows in Parallels, take the following steps:
    1. Go to the location where you created connect-to-mac.cmd.

    2. Open connect-to-mac.cmd.

    3. Leave the window open!
    After you do this, you should connect any attached Android devices to the Mac side not the Windows side if prompted by Parallels.

    That’s it! You can now start Visual Studio and run your app on the Android Emulator in the same way that you normally run it.
 
Upvote 0

Blue.Sky

Active Member
Licensed User
Longtime User
Hi.
I use your tutorial.
I make all file and when i run connect-to-mac.cmd show error FATAL ERROR: Network error: Connection refused
i select "Shared Network" and get ip in terminal command "ifconfig | grep inet"
and change username and password but not working and show error
please help me
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
Open the Emulator on Mac:

~/Documents/android-sdk-macosx/tools/android avd

and start your emulator,

Open Putty on Windows, set the IP of Mac, set the tunnels localhost:5555 and localhost:5554

Open session with your user and password,

Paste this: #!/bin/sh
and pasete this: ~/Documents/android-sdk-macosx/platform-tools/adb kill-server

That's all, you can debug your app's to the Mac Android Emulator.
 
Upvote 0
Top