UIAutomator2 and Android Studio emulator issues on M1 Mac - android-emulator

I'm having trouble starting the AtxAgent of UIAutomator2:
Trying to start the atx server from command line:
adb shell /data/local/tmp/atx-agent server --nouia --addr :7912
Gives:
/system/bin/sh: /data/local/tmp/atx-agent: not executable: 32-bit ELF file
I'm running this from Android Studio on an M1 Mac mini (Arm).
I'm emulating a Pixel 2 with Android 10 for arm64. I have also tried Android 11, 12 and Sv2 and get the same error.
This works on my Intel Mac mini, so issue might be arm related?

This error was due to the atx-agent not being compiled for arm64 v8.
I downloaded the source and compiled it then pushed to the emulator and now it works.
OSX instructions
Don't remember exactly how I did it, but these are my notes (you first need to install HomeBrew):
brew install go
sh build-run-fg.sh
go mod download github.com/BurntSushi/toml
Then to install the agent on your device. First get the device using
adb devices
Then:
adb -s emulator-5554 push atx-agent /data/local/tmp/atx-agent
adb -s emulator-5554 shell chmod 755 /data/local/tmp/atx-agent
adb -s emulator-5554 shell /data/local/tmp/atx-agent server -d

Related

flutter Project is not working in simulator mac os

I installed the flutter and using android studio to run the flutter project on simulator. I clone the project from git and run it shows this error
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
Error running pod install
Error launching application on iPhone 14 Pro Max.
but when I make the new basic project it runs fine but not the cloned project. I tried some stuff.
open ~/.profile and add these
exports export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Also uninstall cocoapods and reinstall again. but nothing works for me.
what i am missing here?
Spending few hours on this problem finally it works for me.
Step 1: Uninstall the cocoapods by running this command in your project folder terminal
sudo gem uninstall cocoapods
Step 2: Install the cocoapods by running this command
brew install cocoapods
Note: Not forget to restart the android studio otherwise it would show another error. just close your project, close android studio, rerun the project or simulator.
Hope it will help someone.

Can't install Flutter on Mac

This is the only install that fails, I have already installed Flutter on 2 other Macs without any issue.
It's a MBP 15-inch, 2018 running Mojave.
What might interfere with the installation is SentinelOne, that's installed on this machine and that I can't remove, so I need to somehow work around it.
Here's flutter doctor:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F203, locale en-BE)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[!] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.dev/platform-plugins
To install:
brew install cocoapods
pod setup
[!] Android Studio (version 3.4)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
I run brew update and then:
$ brew install --HEAD usbmuxd
==> Cloning https://git.sukimashita.com/libusbmuxd.git
Updating /Users/me/Library/Caches/Homebrew/usbmuxd--git
From https://git.sukimashita.com/libusbmuxd
60109fd..6539b02 master -> origin/master
==> Checking out branch master
Already on 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
HEAD is now at 6539b02 iproxy: Fix (newly introduced) timeout errors not being handled
==> ./autogen.sh
Last 15 lines from /Users/me/Library/Logs/Homebrew/usbmuxd/01.autogen.sh:
2019-07-04 13:22:50 +0200
./autogen.sh
./autogen.sh: line 6: libtoolize: command not found
./autogen.sh: line 8: aclocal: command not found
./autogen.sh: line 9: autoheader: command not found
./autogen.sh: line 10: automake: command not found
./autogen.sh: line 11: autoconf: command not found
./autogen.sh: line 14: ./configure: No such file or directory
Any help would be greatly appreciated.
I ran into the same issue few days ago.
First you have not completely installed all the requirements of Android studio and Xcode.These errors stamps from improper installation and configurations.
Follow these steps.
Install or reinstall Android Studio -for the latest version
Install or reinstall Flutter macOS
https://flutter.dev/docs/get-started/install/macos
Install or update Xcode - this takes nearly a couple of hours depending on your connections.
Once all is installed - you need to run the command Lines to accept the agreements for Xcode and Xcode toolbox.
Install cocoa pod also using the command Line as mentioned in the flutter guide.
Finally, make sure that your flutter path in located somewhere you can find it and create a .zshrc file and expose the path into this file. I recommend /Users/johndoe/Development
`nano ~/.zshrc'
export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
per my recommendation it would look like this
export PATH="$PATH:/Users/johndoe/Development/flutter/bin"
you have to install brew for that, first of all you have to run this command and after that run all other command as suggested in flutter doctor result.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
download java from following link and install it.
https://support.apple.com/kb/dl1572?locale=en_US
Android studio 3.4 is not now supported with flutter, so as of now you can not solve this error.
for More details you can refer this video.
https://www.youtube.com/watch?v=Xy-qHlaHr6c

Can't install sdkman on Mac OS

I am running Mac OS High Sierra and trying to install sdkman like so:
curl -s "https://get.sdkman.io" | bash
I get no messages returned, but am simply returned to the terminal prompt:
$
If I try:
sdk version
I get:
sdk: command not found
This was due to CURL not being able to run in HTTPS mode. Had to use BREW to install a new version of CURL with SSL enabled. SDKMAN is now installed.

"Could not connect to lockdownd" while attempting to run flutter app

I am following the Get Started tutorial.
I can install everything, flutter doctor returns all checkmarks but in the end there is a message:
idevice_id returned an error:
ERROR: Could not connect to lockdownd, error code -2
Same message appears if I try to run the app using flutter run or if I try to list the devices using flutter devices.
The tutorial also states that:
Note: If the Run & Debug buttons are disabled, and no targets are listed, Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed
I have two devices listed my Android phone and an iPhone simulator. Run and Debug buttons are ENABLED!
How can I run my app using flutter? It can be either using the command line or IntelliJ IDE.
Disconnect all iOS devices, then:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
sudo rm -rf /var/db/lockdown/*
Connect an iOS device, and choose "Trust" when prompted, after that:
sudo chmod -R 777 /var/db/lockdown/
This workaround worked for me when loosing the connection:
close everything (Visual Studio Code, Xcode, Simulator)
disconnect any physical device
Start Visual Studio Code
connect a physical IOS phone
Start XCode
build from XCode (it will work)
Disconnect your physical device
Start without debug
You will be prompted to connect to a device
and from there it worked again!
This just to help to debug the loos of connection bug. I have also observed that it begins just after the "stop debugging" command from Visual Studio Code.
I was having similar issues, and resolved them using the below. Hopefully this will help you. flutter doctor was telling me the answers, but they were a bit buried. Look for something like this:
[-] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.3, Build version 8E3004b
✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.1
✗ ios-deploy out of date (1.9.2 is required). To upgrade:
brew upgrade ios-deploy
• CocoaPods version 1.2.0
There are four brew commands in there to run. When I did them, this problem disappeared for me. Good luck!

Why can't I run the android emulator?

I have installed everything like I was told to by the android website and all I keep getting after I create my avd is
"Failed to start emulator: Cannot run program "/home/christopher/Desktop/android-sdk-linux_86//tools/emulator": java.io.IOException: error=2, No such file or directory".
Anybody got any ideas??? I'm running linux if that helps.
If you're running a 64-bit system, you need to install ia32-libs:
sudo apt-get install ia32-libs
If you are running Ubuntu 13.10 x64 or the latest Linux Mint x64 then the ia32-libs package is not available anymore. The solution which worked for me without any problems is to:
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1
Hope this will help!
It's a lib32 problem, you need to install getlibs (http://frozenfox.freehostia.com/cappy/getlibs-all.deb) and run it against applications that do not work (e.g., adb and emulator).
cmd from first comment didn't worked for me (Crunchbang linux) so I solved this problem with
sudo aptitude install ia32-libs lib32ncurses5 lib32stdc++6
In directory tools, there are many types of emulator, while my computer works with emulator64-arm! My system is Linux Mint 16 amd64! Good luck!
./emulator64-arm #yxphone -sdcard yxsd -scale 0.8
Another alternative to that, and one in which you will not need to add archs or install anything, is going to the android-sdk install directory, and then to tools dir. There you'll find the emulator executable and plenty other emulator executables too.
Since the emulator file seems to actually be a chooser to which one of the others it will launch based on your OS arch (the problem is that the file itself is a 32bit executable), you can just rename it to emulator.old or something and then make a symlink named emulator to the correct file (mine was emulator64-x86 for amd64 arch). So...
cd (...)/android-sdk/tools/
mv emulator emulator.old
ln -s emulator64-x86 emulator
And it should work! The downside for this is that you'll probably have to do it everytime you update the SDK Tools and also will only fix the emulator, adb and some other tools will have the same problem! Anyways, still an alternative!
64-bit system needs to install ia32-libs and it is working with latest Linux Mint 16 Cinnamon. I have used this. Just run Commands in terminal
sudo apt-get install ia32-libs
sudo apt-get update
Try this, for me work fine
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386