How can I launch Android Emulator without android studio on Mac M1 - macos

I'm trying to start the emulator with this command emulator -avd Pixel_4_API_30 but it gives me an error:
[8633370112]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/Users/primulax/../emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory
Android Studio specs:
Build #AI-203.7717.56.2031.7935034, built on November 21, 2021
Runtime version: 11.0.10+0-b96-7249189 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.2
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin
✅ I was able to run with ~/Library/Android/sdk/emulator/emulator -avd Pixel_4_API_30 with this command

Use ~/Library/Android/sdk/emulator/emulator instead of ~/Library/Android/sdk/tools/emulator on MacOS, for Ubuntu use ~/Android/Sdk/emulator/emulator.

I just experienced the same issue on a freshly setup machine, emulator installed through SDK manager and all.
The error message says it all actually: If you go to /Users/primulax/../emulator/qemu/ on your machine, you'll notice that of course there is no darwin-x86_64 directory, but darwin_aarch64, since you are on an M1 machine. Whatever the reason is the emulator looks in the wrong directory, if you just duplicate the darwin_aarch64 folder and name your copy darwin-x86_64, it works as intended. Not ideal, but it's a workaround until this path-problem is fixed.
Edit: Please take a look at #Andrew Stromme's comment. Of course symlinking is a much more elegant solution to this problem!

If you have Android Studio installed, you can run the emulator from terminal without having started Android Studio first.
First of all, run
cd ~/Android/Sdk/tools && ./emulator -list-avds
to get a list of all the available Android virtual devices that you have installed.
Then, copy the name of the virtual device you want to use and run
cd ~/Android/Sdk/tools && ./emulator -avd YOUR_DEVICE_NAME
where you replace "YOUR_DEVICE_NAME" with the name of a virtual device that was listed in the installed virtual devices list.
This info and more that you may find useful can be found in the official documentation.
Now for the error you get it's most possibly due to a wrong file path. It seems that others have also faced this issue and a bug has been opened before here. The most common solution proposed is to launch emulator from the
/path/to/android-sdk/tools
directory in command line.
Also, before trying this or any other solution listed in this issue tracker, firstly make sure that you have installed from the SDK Manager the Android Emulator in SDK Tools.

Related

How to fix dsymutil in Xamarin

I am trying to build the iOS App on a real device but unfortunately I get hit by a
dsymutil exited with code 1
Things I did:
I did search google but it says my Harddisk is full which is not the
case.
I did try to clean and build multiple times - No success
I did try to reinstall CommandTools by using command xcode-select
--install - No Success
I did remove the CommandTools and then did the reinstall - No Success
Just an FYI
I am using Xcode 11.4 Beta 2
I am logged in with my Apple Account on the Xcode
What my cause this issue?
Any other info you would like to ask do ask.
Thanks
Build Log:
CIS.iOS -> D:\VS Projects\CIS\CIS\CIS\CIS.iOS\bin\iPhone\Debug\CIS.iOS.exe
Detected signing identity:
Code Signing Key: "#####"
(7ECA06BC28377204C91D2E63E69C233982161B28)
Provisioning Profile: "Development" (5aa7573d-6dc8-43e4-9bb0-c65efc5a361a)
Bundle Id: com.#####
App Id: 37M96SGRTW.com.#####
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch #/Users/zilon/Library/Caches/Xamarin/mtbs/builds/CIS.iOS/0e17d2ede92713351eb68ac0146dd15c/obj/iPhone/Debug/response-file.rsp --gcc_flags=-ObjC
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): warning MT4174: Unable to locate the block to delegate conversion method for the method CIS.iOS.AppDelegate.WillPresentNotification's parameter #3.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil -t 4 -z -o bin/iPhone/Debug/CIS.iOS.app/../Protobuf.framework.dSYM bin/iPhone/Debug/CIS.iOS.app/Frameworks/Protobuf.framework/Protobuf
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(963,3): error MSB6006: "dsymutil" exited with code 1.
Here is the solution:
I went inside Xcode.
Preferences>Locations> Command Line Tools. Mine was on 13.2, needed to
upgrade to 13.3 (Thought I already had but it must not have done it
automatically)
Click here for more details
Check for Xamarin.ios version, mine was incompatible with visual studio Mac
i changed it when I was debuging on a windows machine connected to a Mac and VS windows said if I wanted to download compatible version, clicked yes and it downloaded and installed on the Mac computer
After that, I wasn't unable to debug on physical devices
suddenly after almost giving up a "Xamarin.ios update is ready, click to install update" came on VS Mac
after that I got no errors
This discussion was very helpful. I also had to make sure my VS for Mac updates were all installed. Once they were, everything needed to align just right, it worked.
We have resolved this issue now. All we did is we just updated Xamarin.iOS, Mono Framework MDK and Visual Studio for Mac to the latest versions.
Just go to Visual Studio → Check for Updates and then update all.
Source: xamarin_forums
The error is kind of a hair puller.
So here is how I did it
First I uninstalled ALL of the XCODE
I followed this article on stackoverflow
After that I downloaded the Xcode from Apple from this article
Also download the CommandLine tools for that version. After that it worked and now I am not getting any error.
Remember this that CommandLine Tool versions should also match. 11.4.2 will not work with 11.3.1. I tested this and wasted alot of time.

Can't launch AVD on macOS 10.13

I created some AVDs in Android studio 3.0, but I can't launch them. I used the following command to launch them:
./emulator #Nexus_5X_API_17
logs:
emulator: WARNING: encryption is off
Hax is enabled
Hax ram_size 0x60000000
Failed to open vm 3
Failed to create HAX VM
No accelerator found.
failed to initialize HAX: Invalid argument
And when I reinstalled "Intel x86 Emulator Accelerator(HAXM installer)", the logs:
HAXM silent installation only supports macOS from 10.8 to 10.12 !
I don't know if it is related with this.
After that, I tried to install virtualBox to install genymotion, but I found when I clicks the virturalBox.dmg, the installer crashed.
Could you help me? thanks.
Use the new Hypervisor.Framework support instead of HAXM on macOS, as described in the comments of the issue filed for this:
Try running the emulator on Canary channel 26.1.x (API 25/26
recommended) with Hypervisor.Framework; put the text "HVF = on" in
~/.android/advancedFeatures.ini (create this file if it doesn't exist
already).
You can download and install the latest version haxm
https://github.com/intel/haxm/releases/latest
Following steps worked for me:
Uninstall HAXM from android studio SDK manager (Tools->Android->SDK Manager->SDK Tools then uninstall 'Intel x86 Emulator Accelerator (HAXM)' by unchecking it.
Download the HAXM version 6.2.1 zip file from Intel site https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement-macosx
Install the .dmg file
Restart your computer
Open your AVD having x86_64 image and it should work.
Go to your SDK installation directory, and manually run the HAXM installer. See step 4 on the page: https://developer.android.com/studio/run/emulator-acceleration.html#vm-mac
Technically HAXM is only officially supported up until MacOS 10.12 (Sierra) . Since MacOS 10.13 is still in beta, there may be a bug or incompatible API. If the wizard does no work, please file a bug here for the Android Emulator dev team to investigate further: https://source.android.com/source/report-bugs
Go to Tools->Android->SDK Manager, then in the SDK tools search for Intel x86 Emulator Accelerator (HAXM installer) and update to the latest version, restart and thats all!
On install/reinstall of HAXM you get:
HAXM silent installation only supports macOS from 10.8 to 10.12 !
From https://issuetracker.google.com/issues/62395878#comment44
in System Preferences > Security & Privacy > General, there was a message “System software from developer xxx was blocked from loading.” with an Allow button. Clicking the allow button enabled HAXM again
I just redownloaded the simulator and it worked.

Titanium Alloy with Android Emulator on Windows 10

I'm having huge problems with Titanium Alloy on Windows 10. I am using the Atom editor to write my apps. Whenever I execute ti build, enter the command up to 10(!!!) times until an Android device can be found.
For the Android emulator I get an error message as follows:
[Error] Failed to install apk on "emulator-5554"
[Error] Error: device not found
I tried the commands ti build -p android, ti build -p android -T emulator and ti build -p android -T emulator -C emulator-5554 --log-level info. I also tried starting the emulator manually from avd.exe. I deleted the AVD and created a new one, too
When a device (USB debugging enabled) is connected, i tried ti build -p android -T device and ti build -p android -T device -C XT1032, where XT1032 is the name of the device. I get an error message as follows:
[ERROR] Unable to find any devices
I didn't try so far if the device will be found after some more tries.
When executing the commands, I tried all 4 combinations:
emulator off, device disconnected
emulator off, device connected
emulator on, device disconnected
emulator on, device connected
I uninstalled Titanium, Android SDK, NodeJS and Java and deleted all folders of them. I removed all registry entries, too. Then I installed everything again, Titanium at last. Same problem.
I am using Java 32 bit (v8.0.1020.14), NodeJS v4.2.6 (also tried v6.3.0, but v4.2.x is recommend), Android SDK (SDK Tools v25.1.7, SDK Platform-tools 24.0.1 and SDK Build-tools 21.1.2. I also tried SDK Build-tools 24.0.1, but 21.x.x is recommend) and Titanium (SDK v6.0.0.v20160719180254, CLIv5.0.9).
I modified my environment variables as follows:
PATH:
C:\android-sdk\tools;C:\android-sdk\platform-tools;C:\android-sdk\ndk-bundle;C:\Program Files (x86)\Java\jdk<version>\bin
JAVA_HOME:
C:\Program Files (x86)\Java\jdk<version>
ANDROID_SDK_HOME:
C:\android-sdk
I had to set ANDROID_SDK_HOME and C:\android-sdk\ndk-bundle, otherwise the NDK and the AVDs wouldn't be found by ti setup check.
Here is a screenshot of ti setup check: link to image
I don't know why https://www.google.com is unreachable. Furthermore, Intel HAXM is installed. I even reinstalled it without success. The previous installation of Titanium could find it...
Thanks for your help!
TLDNR: my Titanium Alloy installation has problems finding devices. It only works from time to time without any obvious pattern
The process terminates after building the APK file. If the emulator is running, it is possible to manually install the APK. Use this command in the Command Line:
<Android SDK folder>\platform-tools\adb.exe -s emulator-5554 install -r -d <project path>\<project folder>\build\android\bin\<project name>.apk
The project name is equal to the project folder name. After installing the APK, the application can be started manually in the emulator.
Nonetheless, there are still a lot of issues when developping on Windows 10... I think this forces me to switch to a MAC.

sqlite in the xamarin android player

I have clicked on Tools -> Android -> Android Device Monitor in VS 2015 and got the following error, but my xamarin android player works fine.
Is there a way to access to local database (sqlite) in the xamarin android player simulator not on the physical device?
Update:
I am using adb and getting the following error
Failed to load the JNI shared library "C:/XXXXX/jvm.dll"`.
This is a sign of a mixed 32/64 Java bit Java install and/or the wrong version is installed.
Xamarin on Windows requires a Windows x86 version of v1.7
It is essential to install the 32-bit version of the Java JDK even if you're using 64-bit Windows. It is also important that v1.7 of the Java JDK is installed (although it is fine to have 1.8 or newer installed at the same time).
So I would start by installing Java v1.7, since the error is pointing to v1.6 and retrying to open the Android Device Monitor.
Installing the Java SDK (JDK)
The JDK can be downloaded from any browser by visiting Oracle’s website and browsing to the section with the heading Java SE Development Kit 7u79
Ref: https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/#Installing_the_Java_SDK_JDK
Solution 1:
I run tools->android-> android adb command prompt in visual studio
I have followed the followings to access the database
step1. >adb shell
step2. >cd data/data
step3. >ls -l|grep "com.xxxx"
step4. >cd "com.xxxx"
Then I used the following to copy sql file to my workstation
adb shell "run-as com.xxxx chmod 666 /data/data/com.xxxx/files"
adb pull /data/data/com.xxxx/files/xx.sql
adb shell "run-as com.xxxx chmod 600 /data/data/com.xxxx/files"
Then I have downloaded sqlite browser to open the file and see the tables.
Solution 2:
Alternatively, you can go to following directory and double click the exe file
C:\Users\XXXXX\AppData\Local\Android\ANDROI~1\tools\lib\monitor-x86_64\monitor.exe

/dev/kvm not found on mac

So I've been working with android studio 2.0 beta on my Mac and AVD was working fine.
But then I notice that android studio can't launch AVD now. It says /dev/kvm not found. enable VT-x in your bios security settings, ensure that your linux distro has working kvm module.
The thing is: I didn't touch bios settings at all. Possible causes :
VMWare - I was playing with virtual machines and configuring new networks for vm's just before I noticed the error.
CleanMyMac - I also used this app to clean the system
other causes are possible, but I never entered BIOS or touched system settings
The solutions on resolving this issue I found all refer to Linux, rather than Mac. How would I fix this?
EDIT:
I reinstalled OS X (without formatting hard drive). That didn't work.
Here is the solution that worked me.
Well, Android Studio need HAXM to run emulator.
The issue is that the HAXM drivers doesn’t support the beta version of Mac Os High Serria yet.
The driver works but with a little bit of additional command.
First, you will need to disable the Security Protection on kext. The drivers is not sign for this version.
From https://apple.stackexchange.com/a/269777:
Get into Recovery Mode by restarting and holding down ⌘+R until Apple logo appears.
In the top menu click Utilities > Terminal.
In the Terminal window type and press Enter:
csrutil enable --without kext
Then restart the Mac.
Then you can install HAXM from:
Download the driver from here https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager/ and unzip it.
Open a terminal and go to the directory of the driver :
cd Downloads/haxm-macosx_v6_2_0
# edit the file and look for 10.12
nano silent_install.sh
CTRL + W
10.12
Add 10.13 after 10.12, and save the file ( CTRL+X, Y, ENTER)
Run it:
./silent_install.sh
To be sure it works:
sudo kextload -bundle-id com.intel.kext.intelhaxm
Now your emulator should work !
Just remove the previous HAXM and install IntelHAXM_6.0.3.dmg in haxm-macosx_v6_0_3.zip
here is download link haxm-macosx_v6_0_3.zip
its work for me!
/dev/kvm not found on mac.
Follow the steps. You can solve your problem.
Step1: Download Intel HAXM from software.intel.com.
Step2: Extract and Open the file name like “IntelHAXM_6.2.1.dmg”.
Step3: Double click on “IntelHAXM_6.2.1.mpkg” to Install manually.
Step4: Read and Install carefully.
Step5: When you receive Security warning for new extension goto system preferences and Click “Allow” button.
Step6: That’s it. Now you can run the emulator.
(Note : Incase you get same error again. Please Re-Install the
“IntelHAXM_6.2.1.mpkg” Once again. That’s really fix your problem.)
Happy coding... :-)
Enter your VM settings and then search for virtualization engine :
Check the virtualize Intel VT-x/EPT or AMD-RVI option.
This should resolve the problem.
Your MacOS need to enable Intel VT-x
Reference:
enable Intel VT-x

Resources