Xamarin Studio Android Emulator Extremely Slow - xamarin

I am using Macbook Pro 2015. I installed Xamarin Studio and Android SDK
I created AVD like this
When I start my AVD, it never moves further than screen showing "android" on it, even 1/2 hour after starting it
adb devices command shows:
adb devices
List of devices attached
emulator-5554 device
Is there something I am doing wrong in setting my emulator. I am aware that android emulators are slow but it wasn't this slow. I am also aware of HAXM but I found instruction to install them bit to flaky and I dont want to take a risk. I also know about Genimotion but that is not an option for me.
Is there another way to speed up the android emulator?

I had the same problem and I used an alternative solution to fix this problem.
Install VMware or VirtualBox
Download the ISO file of your android platform http://www.android-x86.org/download
Create a virtual machine with the ISO file
You can use these settings:
Target OS: Choose Linux
Target Os version: Other
1 GB RAM
Add a new hard drive: VDI drive, dynamically sized
Start the VM
Now you can connect Xamarin to the VM.
Find the path to your Android sdk-platform-tools
Open a terminal in your Host and locate sdk-platform-tools and type ./adb connect
Now you can run your code from Xamarin to the virtual machine, which is really fast compared to simulation from Xamarin.

make sure that Android version of your Target Framework is the same of smaller than Android version of your emulator you have chosen to build.

Related

Android Studio for blind developer

I am a blind Java developer. I am following a training in full stack JavaScript and we are learning React Native after React for the web.
I would like to test code with Android Studio emulator, instead of installing on a device.
At the moment I am not able to test my code, and it is very disturbing to learn.
Is there a solution for me to use my screen reader (NVDA on Windows and orca on Linux) with Android Studio emulator window? Because actually my screen readers recognize emulator window as a picture, it is not able to focus widgets.
I would like to use emulator and use the integrated Android screen reader talk back in Android Studio to test my code.
I have followed instructions on this page:
https://developer.android.com/studio/intro/accessibility
I use Expo to launch my project on terminal.
I launch Android studio and start an Android emulator.
I used a NVDA which is 32 bits software.
So I had set up a Java 8 32 bits, because it's the only 32 bit version that I found.
I enabled the Java access bridge with command line in JRE 8 directory, but I have also an Open JDK 11 64 bits installed, it could be a problem.
The main problem that I can not get focus on Android emulator windows.
As far as I know, you can't.
If I remember correctly the Android emulator is not a fully fledged VM, like VirtualBox or Qemu, so you can't use it like a device with the full Android operating system.
In simple words, the Android emulator catches all system API calls and makes your application think it is running into a real Android device. So because TalkBack or accessibility services are separated apps and the emulator can't run your application alongside the accessibility services.
I'm so sorry, but probably the simplest way is to grab an Android phone, a used one from E-Bay for example, to connect directly to Android studio and test your apps.
When choosing a test device take into account the fact that most of the time smartphone vendors apply customizations on the Android version that ships with their devices, so make sure that TalkBack is proved to work reasonably well.
About Java, NVDA and AccessBridge: if you are using the latest version, both NVDA and Android Studio, you don't have to worry about AccessBridge and 32bit stuff. I'm pretty sure that with recent NVDA versions the program runs in 64bit mode and Android Studio ships with his 64bits VM with AccessBridge already there, I'm working with this configuration. In case you may try to activate it with jabswitch --enable command.
On Linux the things are rather difficult, you have to use a distributions with all accessibility software up to date, including Java ATK wrapper, but take into account that Android Studio is not officially supported with Linux accessibility framework at the moment so you have to work with Eclipse or with a simple editor like VS Code.
Please use your Android Phone for such features, because Android studio is not a full fledge Emulator. But using your phone continuously with your Laptop/PC can be a big hassle, so using following method (by getting someone's help) get your phone connected to Android studio Wirelessly.
adb tcpip 5555
adb shell ip addr show wlan0
adb connect ip-address-of-device:5555
IP Address can be found in Settings → About → Status.
This is how you can use all android features for blind people.

How to export flutter app from android studio to Xcode?

I have an application running on Android, and it's on play store already.
Now I want to start deploying to Appstore,I managed to get a Mac for this.
I'm trying to import the project to Xcode,but flutter run gives errors for different paths of flutter and packages.
Is there an easy way to export from Windows and Android studio to Mac Xcode and not wasting hours only to open the project?
EDIT:
The error it gives: Your application could not be compiled, because its dependencies could not be established. The following Dart file:
/Users/bojke/Desktop/app/lib/main.dart ...refers, in an import, to the following library: /C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud-firestore-0.8.2+3/lib/cloud_firestore.dart
Unfortunately, that library does not appear to exist on your file system.
That's because I can't name a directory with doubledot..
Thanks!
Forgot to do:
flutter packages get . This solved my problem.
You don't "export from Android Studio to Xcode". The flutter project contains the projects for both native problems. Run
flutter build ios --release
Then go into the iOS project and open your Runner workspace for iOS then archive your project from there.
Once you're in the xcode project follow these instructions
Connection to physical iPhone device is not necessary. Run any sample project in xcode. Start a Simulator. (Only One simulator preferrably).
clone the repository from github into Mac (with X-Code Installed)
open terminal.
cd to your pubspec.yaml
flutter run (it will automatically run flutter pub get) (It will launch on the already running iOS simulator)
follow steps on flutter.dev to install flutter. Above steps will only work from terminal if flutter doctor(any flutter command) is recognized
I would definitely recommend installing Android Studio on your Mac and run your app on an iOS simulator or real iOS device from Android Studio.
Make sure everything works fine, and only then build for release.
Here is a step by step instruction on how to set up your Mac environment for Flutter
And when you feel your app is ready for the open-world - check out this doc on how to build and release an iOS app
Also, if you don't have a Mac you can start a virtual machine with Mac OS X, hosted on your Windows or Linux. It will give you the ability to run your Flutter app both on iOS simulator and on physical iOS devices, as well as Android emulator/real device.
For example, I have an OS X Mohave running on my host Windows 8.1 on VMware. Make sure you have enough RAM and CPU to run both OS. I allocated 6GB of RAM to the virtual machine and it runs at a speed enough to make some fixes for iOS, run on iPhone simulator and release a build on XCode.
Clearly it would be annoying to work at that speed all the time but for my purposes its enough.
If you don't want to mess around with virtual machine - check https://www.macincloud.com/ it's a cloud service for getting remote access to a dedicated Mac. (with XCode installed) for $20/mo. For 8 hours per day, it's something like $35/mo.
Good as a temporary solution if you don't want to spend $2k for a MacBook Pro

react-native and Visual Studio Emulator for Android

is it possible to run react native app on Visual Studio Emulator for Android (standalone) and if yes what are the steps to set it up? I can successfully start emulator, that part works but cant figure out how to config react-native to use it instead of "adb devices".
My current attempts end with error:
Could not debug. Error while executing command 'adb devices': Command failed: adb devices
'adb' is not recognized as an internal or external command,
operable program or batch file.
I know about Android Studio and virtual devices that come with it but I would like to try that as the last option. My environment is: Windows 10 pro, VS Code (with React Native Tools Extension), react-native, yarn.
UPDATE
even though I did not get anywhere in my attempts to make it work
I just would like to share what knowledge I gained while struggling with this issue
because it is possible that my issues are specific to my environment but it might work on another PC.
Theoretically it requires very few steps to run react-native in Visual Studio Emulator for Android
in VS code without installing Android Studio or Visual Studio.
Install Visual Studio Emulator for Android, standalone
https://www.visualstudio.com/vs/msft-android-emulator/
download Android Debug Bridge (adb)
it is included with Android SDK Platform-Tools, download and read more here:
https://developer.android.com/studio/command-line/adb.html
it downloads as zip file, you unzip it and then add a path to adb.exe in PATH environment variable,
so you can execute adb command from any path. I am using yarn and it needs that to know where adb.exe is.
It is kind of a connector between your app and virtual or real android device
it has to be running before you start emulator and basic command are:
to stop - adb kill-server
to start - adb start-server
to see list of devices that adb recognized - adb devices
I also found a specific instruction on how to make Visual Studio Emulator for Android work with adb:
https://msdn.microsoft.com/en-us/library/mt228282.aspx
'Visual Studio Emulator for Android' devices are not listed in the Android Device Monitor
it is a registry edit for key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
apparently Visual Studio Emulator for Android is using that and you can create it if it is not there
and just add/modify Path variable to be a path to adb.exe.
now you can start Visual Studio Emulator for Android and after that open integrated terminal in you react native VS code project
and type:
yarn run android
and if I get it right (and in the perfect world) your app should get installed and shown in Visual Studio Emulator for Android,
well, not for me, my emulator never shows up as a device when I type adb devices, all I see is a blank two lines.
So I think I spent enough time on this trying to make it work and in my case the answer to my own questions is:
theoretically you should be able to run Visual Studio Emulator for Android with react-native from VS code but in reality
it probably will not work, so seek something more reliable.
I did see a little light at the end of the tunnel when I tried connecting my phone with USB using expo app, adb picked it up right away,
"yarn run android" started doing something and expo even tried to load my app, I held my breath, my heart was racing, I was ready for a miracle... and .... boom... it just crashed, but this could be easier
for me to resolve though, it appears some networking config issues, my phone does not recognize IP address which was in the output after running yarn
and if this works,(big IF) then it is still good, I can run/debug react-native without using Android/Visual Studio.
Final update:
could not make it work, stopped all attempts and went for Android Studio instead, Android Studio emulators work with react native and expo without any issues. (well, not yet, sample app runs OK at least.)
The same symptoms occurred to me when trying to set both React-Native and VS Emulator for Android together, and the following steps solved them:
On the VS Emulator for Android, I checked my emulated phone's IP at the Tools/Network tab. Emulator Adapter #1 refers to the emulated phone.
Then, I headed to the terminal and ran adb connect <ip_address>:5555. That made the emulated phone available to Android Studio as well as to React-Native.
if you already install android studio
then add C:\Users\manu\AppData\Local\Android\Sdk\platform-tools path into environment path (replace your username instead of manu)
if you have not android studio then
need download adb from https://github.com/intel/haxm/releases/download/v7.0.0/haxm-windows_v7_0_0.zip
then install
intelhaxm-android.exe
.
open a new terminal and now adb commnad will work
it is haxm source website https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm

Can we use an Ipad Pro to compile xamarin ios projects with Visual Studio on a windows machine?

The xamarin documentation mention that we need an MacBook connected to the network to be able to compile a xamarin ios project on a windows machine.
However can we use an IPAD Pro for this also ? Otherwise I have to buy a MacBook just to connect to my network ?
https://developer.xamarin.com/guides/ios/getting_started/installation/windows/connecting-to-mac/
No. You need a Mac running a current version of OS X to act as a build host. An iPad Pro does not run OS X.
As Dylan S mentioned, getting a cloud hosted mac (like macincloud.com) would be the best solution for you. From what i've seen they got pretty reasonable plans and their website seems pretty informative

build ios app with visual studio using xamarin, without mac build host

I am a new user to xamarin.
I installed Xamarin.IOS on visual studio. When i create a new project and want to build it, vs says that you should select a "mac build host".
Is it necessary for building ios application?
May I do that in a simulator? because I don't have a Mac machine.
Thank you very much.
You must have a Mac to act either as a build host or your primary development machine in order to build an iOS app. The iOS build process relies on the Apple iOS SDK and tools that are ONLY available from Apple on OS X.
If you are completely refused any idea of buying Mac here the solution. In my case I use next tools:
Windows 8.1 x64
Visual Studio 2015 Update 3 (Xamarin inside)
VMWare Workstation 12
Inside VMWare Workstation:
OS X 10.11 El Capitan
XCode 7.1 (Xamarin's developers recommend 7.3)
Xamarin Community 6.0.1
General advice is to use latest versions and updates of all tools.
Install El Capitan as it described here.
On VM install latest XCode (you probably need Apple ID for it) and iOS part of Xamarin Studio. If Xamarin Installer generates error on downloading JDK 7 then download and install it before Xamarin Studio
Enable Remote Login in MacOS settings and allow access for your user
Configure VM network as NAT and make port forwarding for port 22
Run Visual Studio on Windows and create iOS project.
Connect to Mac using IP 127.0.0.1 and type your Mac's username and password
Select appropriate iOS emulator in Visual Studio and run.
Here the proof pic
Regarding this topic I've tried many approaches. I spent too many hours trying to install hackintosh on a VM on my MS Windows 10 system... I tried a lot of receipts... I could install it free times but I couldn't reboot it none of the tries. ##£%&!!!!
Before this anoying "R&D" I searched for a cheap second hand Mac and I also searched after but without getting good results...
Today I want to share my next step with you all before starting with it because I guess (I hope indeed) is going to be the solution for my next 4-6 months to do iOS developments with xamarin using VS on a Windows machine without owning a Mac, use a Mac hosting already prepared for dev purposes:
https://www.macincloud.com/checkout/managed.html
For setting up Xamarin iOS with Windows and Visual Studio, you'll need to have MAC to run / test the application in the simulator.
Please review the limitation here http://developer.xamarin.com/guides/ios/getting_started/installation/windows/
You can either install MAC OS X in your windows PC using VM Ware and setup MAC OS

Resources