emulate aosp on Arm64 - android-emulator

I would like to emulate an ARM64 Android 12 Car version on PC.
I did :
repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r5 --depth=1
repo sync -j8
. ./build/envsetup.sh
lunch sdk_car_arm64-userdebug
emulator
But I have a crash : segfault at 7fc8104bec80 ip 00007fc8104bec80 sp 00007fc80e1ab638 error 15 in libQt5WidgetsAndroidEmu.so.5
How to proceed ?
Thanks for your help

Related

I get an error when I try to run the emulator. Is it a problem with the version? [duplicate]

I'm receiving the following error while running flutter run on some projects, however, on other projects it works fine:
(base) Nusraths-MacBook-Pro:flutter_uber_clone rahama$ flutter emulators --launch Pixel_2_XL_API_28
(base) Nusraths-MacBook-Pro:flutter_uber_clone rahama$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing Gradle... 0.8s
Resolving dependencies... 1.4s
Running Gradle task 'assembly debug'...
Running Gradle task 'assembly debug'... Done 9.3s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 1.9s
Error: ADB exited with exit code 1
Performing Streamed Install
ADB: failed to install /Users/rahama/development/flutter_uber_clone/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
Error launching the application on Android SDK built for x86.
It's just the flutter demo project, I haven't made any changes to it.
Actually, the answer lies in the error message of your question:
[ADB: failed to install /Users/rahama/development/flutter_uber_clone/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]Error launching the application on Android SDK built for x86.]
Your Emulator is running out of space, clear its cache:
Click on AVD Manager
Wipe Data (Your Target Device )
You are set to go..
Flutter had a new update (I think last night), run flutter upgrade in the terminal and it should work fine (at least that did it for me).
Docs:
To update both the Flutter SDK and the packages that your app depends on, use the flutter upgrade command from the root of your app (the same directory that contains the pubspec.yaml file)
https://flutter.dev/docs/development/tools/sdk/upgrading
Run in terminal
$ flutter clean
and then
$ flutter pub get
and then
$ flutter packages get
then
$ flutter run
Although I don't have any other apps installed on my emulator, when I install the flutter app, I get the same error.
I found that the storage space of the emulator is indeed not enough. Because when I created the emulator, the default was only 1024M. When I changed the storage space of the emulator to 4096M, the problem was solved.
In my case, it was caused by an adb glitch, not a flutter problem.
This was solved by doing a combination of the following, not sure which step fixed it exactly
Reset adb server on desktop, macOS in mycase: adb kill-server, and then adb start-server
Reset USB debugging on the mobile device.
Restarted the device.
None of the existing answers worked for me, so it wasn't a flutter problem. A plain adb install any.apk didn't work. So I narrowed it down to an adb/usb issue.
this common problem with the Emulator and all you need to clear the Emulator cache .
in my case it was the solution...
1- open AVD Manger.
2- click on the (bottom arrow) that beside (Edit) button.
3- choose Wipe Data.
Sometimes it can work by uninstalling your app and and all it's data then try again,
another fix is to send the apk you are trying to install from projectname/build/app/outputs/apk and to your device and install it and try again.
Note: Following is answer for stuck at Performing Streamed Install by adb install xxx.apk:
phenomenon
use adb install xxx.apk and showing Performing Streamed Install but stuck, hang forever.
Have tried
re-plug USB cable
change USB adapter
change USB cable
reboot PC(Mac)
reboot android phone
restart VSCode
make adb command shorter
from: adb -s hxxxxxxxxs install -r /Users/limao/dev/xxx/crawler/appAutoCrawler/AppCrawler/task/20201202_xxx_0192LeiMoChuanShuo/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android_0.apk
to: adb -s hxxxxxxxxs install -r /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmpq3ypjfgd/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android_0.apk
tried adb shell pm install but not support
etc...
all not work.
Final solution
update (original old version 29.0.5) adb to latest version (30.0.5)
Q: how to update adb to latest version
A:
goto
https://developer.android.com/studio/releases/platform-tools
to download your platform adb
下载适用于 Windows 的 SDK Platform-Tools
下载适用于 Mac 的 SDK Platform-Tools
下载适用于 Linux 的 SDK Platform-Tools
or:
goto
https://www.xda-developers.com/google-releases-separate-adb-and-fastboot-binary-downloads/
to download:
windows
https://dl.google.com/android/repository/platform-tools-latest-windows.zip
Mac
https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
Linux
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip to got folder platform-tools
add the folder to your PATH variable
eg:
vi ~/.zshrc
PATH=/Users/limao/dev/tools/android/adb/platform-tools:$PATH
In my case, this was resolved by updating android studio and all the flutter and dart plugins.
Go to File>> invalidate caches
By this way I resolved this issues on BlueStack.Do these steps for running android applications on BlueStack Emulator.
Go to setting of BlueStack Emulator
Then click on Advance and then
Turn on Android Debug Bridge (ADB)
I experienced this same problem on a physical device, tried all solution i could see out there but none worked.
What worked at the end of the day was to ensure my device API version was also installed in the android studio.
image1
image2
Forewords
This question gets the first result from Google, so my answer covers a bit different error.
The error in question has [INSTALL_FAILED_INSUFFICIENT_STORAGE] code. My answer is for any Performing Streamed Install error that does not specifically define [INSTALL_FAILED_INSUFFICIENT_STORAGE] code.
My Environment
KDE Neon 5.24 (a.k.a. Ubuntu 20.04 but latest KDE stuff)
Visual Studio Code from Snap (I use this mainly)
Android Studio from Snap (I use this to install SDK, Platform Tools and Build Tools)
Troubleshooting
The problem is this globally installed /usr/bin/adb overrides the adb that Flutter uses. As you know, Ubuntu has many outdated packages (to protect their system's stability). ADB is one of them. So, if you try to do:
adb kill-server
adb start-server
You will highly likely get an output similar to below:
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 12668
--- adb starting (pid 12668) ---
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Version 1:8.1.0+r23-5ubuntu2
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 03-26 03:19:35 12668 12668 main.cpp:57]
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:416] adb_auth_init...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:174] read_key_file '/home/erayerdin/.android/adbkey'...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:467] Calling send_auth_response
adb server killed by remote request
* failed to start daemon
error: cannot connect to daemon
In some flutter run sessions, I've got an output similar to "adb server version (whatever) does not match the client (whatever); killing". That's when I had the doubt maybe I have installed adb globally. Check this:
which adb
# /usr/bin/adb
# This is a sign that this adb might be globally installed.
# This must be a symlink. Just to make sure, I do the following...
realpath /usr/bin/adb
# /usr/lib/android-sdk/platform-tools
# This is the evidence that it has been installed globally.
So, we use an outdated version of adb, which does not match the target device's adb server.
Solution
So, we need to get rid of this global adb first.
⚠ Warning
If you use adb from terminal, what we are going to do will remove it. You can add your {SDK PATH}/platform-tools where SDK PATH is where you have installed SDK to get it back.
Simply do:
sudo apt remove android-sdk android-sdk-common android-sdk-build-tools android-sdk-build-tools-common android-sdk-platform-tools android-sdk-platform-tools-common
However, doing these actually does not remove adb from the system. It still lays there for some reason, so, for the last step, we do:
# simply backup our symlink
sudo mv /usr/bin/adb /usr/bin/adb.bak
# and backup global android-sdk tools
sudo mv /usr/lib/android-sdk /usr/lib/android-sdk.bak
After these steps, you can restart your editor and try again. If you want to make double sure, you can optionally do (while your editor's closed):
# clean the build artifacts
flutter clean
# reinstall the packages because we have cleared them
flutter pub get
flutter pub get packages
Android 12 requires you to add a piece of code to your main activity
Go to your project folder and open the AndroidManifest.xml file
Add the below code in the activity
android:exported="true"
I was having the same issue with a physical device connected via wifi, then I figured out what was wrong. The battery of my device was below 15%, it worked as expected after charging. So, keep an eye on the battery status if you're working with a physical device via wifi.

Android emulators are not working on macOS Big Sur 11.3+

I have upgraded the mac OS to Big Sur and none of the emulators are working. It seems that all Android emulators Fails on Mac OS Big Sur Beta. I deleted the old emulators and created new ones with different HW/SW, unsuccessfully. Introduced the following issues in the android emulator.
ffffffffb69b4dbb: unhandled exit 1d
Emulator Engine Failed
adb Device Offline
https://issuetracker.google.com/issues/165038831
Does anyone have a solution?
EDIT 27.04.2021
~/Library/Android/sdk/emulator/emulator -gpu host -read-only -feature HVF -avd Pixel_4_API_29
emulator: Android emulator version 30.5.5.0 (build_id 7285888) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/dunatv/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Users/dunatv/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/dunatv/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
HAX is working and emulator runs in fast virt mode.
qemu-system-x86_64: Back to HAX accelerator
added library /Users/dunatv/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local
UPDATE: 11 Aug 2021
Currently the Emulators and Arctic Fox are working. Tested on Big Sur 11.5.1
Update: this should now be fixed by version 30.5.6 of the Android emulator in the stable channel.
However, if you are now experiencing issues after updating to the latest version of the Android Emulator you can fix this by removing and then adding back the Android Emulator from the SDK Manager.
Tools > SDK Manager > SDK Tools
Uncheck Android Emulator and hit apply.
Check Android Emulator and hit apply.
Original answer:
This worked for me https://www.arthurkoziel.com/qemu-on-macos-big-sur
Essentially, create an XML file called entitlements.xml with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.hypervisor</key>
<true/>
</dict>
</plist>
Copy the XML file to ~/Library/Android/sdk/emulator/qemu/darwin-x86_64
Then run the following commands in terminal:
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64
codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-armel
codesign -s - --entitlements entitlements.xml --force qemu-system-armel-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-i386
codesign -s - --entitlements entitlements.xml --force qemu-system-i386-headless
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64-headless
Update, 10-1-2020
The Android Emulator team has pushed 30.1.5 which fixes this issue in stable. The dev build, 30.2.0 does not contain this fix. It should be available "soon" according to the Googler's working on this.
Another note, if you experience poor performance in your emulator you may wish to try using the host's GPU for rendering. This can be accomplished by running the following command in your terminal where -avd is the name of your emulator device with spaces turned to underscores.
~/Library/Android/sdk/emulator/emulator -gpu host -feature HVF -avd pixel_3a_api_29
Old information, kept for educational value:
This is the reference to the commit fixing this issue for Big Sur. This looks like it should be released in the emulator 30.1.5 (see log https://android.googlesource.com/platform/external/qemu/+log/refs/heads/emu-30-release) which should be in the next canary build.
If you can't wait, you should be able to build off that branch. Lightly tested guide heavily pulling from the readme of the repo:
# Get the google repo tool - you can skip if you already have it
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && chmod +x /usr/local/bin/repo
# Get the code, will take some time. Probably best to go get a coffee here or run on a server if you have poor internet
mkdir -p $HOME/emu-master-dev && cd $HOME/emu-master-dev
repo init -u https://android.googlesource.com/platform/manifest -b emu-master-dev
repo sync -j8
# Get XCode 10.1 - required
https://download.developer.apple.com/Developer_Tools/Xcode_10.1/Xcode_10.1.xip
sudo xcodebuild -license accept &&
sudo xcode-select --install
# Get MacOS 10.13 SDK which is required
export XCODE_PATH=$(xcode-select -print-path 2>/dev/null)
git clone https://github.com/phracker/MacOSX-SDKs
cp -r MacOSX-SDKs/MacOSX10.13.sdk/ "$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs"
# Build the emulator, which will be another coffee break...
cd external/qemu && android/rebuild.sh
# run it :)
./objs/emulator -list-avds
Steps to fix the issue:
1.Open Terminal and go to the directory /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/
2.Create an xml file named entitlements.xml with touch or cat commands
3.Add this content to the entitlements.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.hypervisor</key>
<true/>
</dict>
</plist>
4.Then simply sign the qemu-system-x86_64 with it:
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
5.Now simply restart Android Studio and the Android Emulator should work again!
My solution is wiping data from Android studio AVD, then start it again and again until it is successfully launched, using ./emulator #Pixel_3a_API_29 command.
After trying many of the answers / comments on SO, found this workaround to work and be reproducible:
Setup a new AVD
I used Pixel 3 & 3a, API 30, default options
Launch the AVD using the emulator CLI
$ ~/Library/Android/sdk/emulator/emulator #Pixel_3a_API_30
You'll see the infamous ...unhandled exit 1d
Cancel the command with ⌃ + c or press the x on the emulator sidebar
You should see a spinner about Saving State...
Run the emulator again (step 2), this time it should show:
5. Click DISMISS (or wait) and the emulator should boot into Android
Note: Starting the same AVD from Android Studio / AVD Manager GUI will still run into this exception, so when you need it - start the emulator like in step 2.
Running the emulator like this:
~/Library/Android/sdk/emulator/emulator -wipe-data #Pixel_3a_API_30
Fixed it for me.
As mentionned by #Demirezen, for the time being, it is a code signing issue see details here.
Either code signing by yourself or using emulator 30.6.4 from canary build solves the problem.
Go to /Users/<your user>/Library/Android/sdk/emulator/qemu/
Inside this file you will see files. If the names of those files contain the number 64 then:
Create virtual device with image arm64-v8a + API LEVEL= S
After those steps emulator should be opened.
Spent a whole day trying out different methods, including downloading qemu. Finally...went into Android SDK> SDK tools > updated everything, made sure HAXM installer is installed and ticked. Worked!
After last BigSur beta update (11.0 Beta (20A5395g)), Android Studio keeps shuting down. UI is not responding if I open any subwindow...
Never more beta
Seems to work with emulator 30.2.6 (latest in beta channel at this moment)
Although there was a problem with a lockfile that prevented the emu from launching.
Here's what brought everything back to normal:
Wiping data of all AVDs (not sure if this is required)
Looking through every ~/.android/avd/*.avd/ folder and removing the hardware-qemu.ini.lock file if present.
invalidate caches / restart and re-create the image, seems like some behind-the-curtains configuration is not forward-compatible.
I had the same problem, just update your android studio and all your sdk tools to the latest version and everything will work just fine.
Adding proper ANDROID_AVD_HOME helps somehow.
You can add export ANDROID_AVD_HOME=$HOME/.android/avd to ~/.bash_profile

Carthage update fail with exit code 1 when upgrade MacOs and Xcode

After upgrade your OS and/or your Xcode.
When you run
$ carthage update --platform iOS --no-use-binaries
you would get an output like:
Fetching FooLibrary
A shell task (/usr/bin/env git fetch --prune --quiet https://github.com/foodeveloper/FooLibrary.git refs/tags/:refs/tags/ +refs/heads/:refs/heads/ (launched in /Users/yourUser/Library/Caches/foo.package/dependencies/FooLibrary)) failed with exit code 1
This issue happen with Carthage 0.33.0 and Xcode 11.
To solve this issue:
First: Open your new Xcode and select the last CLI to make sure that you are using the last CLI.
Command Line Tool - Error - xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH
Second: Please You could fix it by deleting the cache of Carthage:
rm -rf ~/Library/Caches/org.carthage.CarthageKit
source: https://github.com/ashleymills/Reachability.swift/issues/340

How can install Flutter Correctly in Windows

I use this line in C:\src
git clone -b stable https://github.com/flutter/flutter.git
And in PATH i type this line:
C:\src\flutter\bin
Then
flutter doctor
but output is :
How can i install Flutter correctly?
some error is:
Error: 'pub upgrade' still failing after 10 tries, giving up.
Error: Error when reading '.packages': The system cannot find the file specified.
Error: Error when reading '../../bin/cache/flutter_tools.snapshot': The system cannot find the file specified.
I had the same problem days ago, what I did is
Remove cache folder inside bin/cache
Run flutter doctor again
Also I just cloned the master branch and then run flutter doctor
git clone -b master https://github.com/flutter/flutter.git
And if it doesn't work, most likely is what #user11945700 is saying, something about Antivirus or Firewall, so I recommend you to disable everything, install it, and then activate again.
Otherwise if you want other version you may use this to dowload Flutter releases versions
Another guess, could you install it if you run the prompt shell as administrator?
I use this link
https://flutter.dev/docs/development/tools/sdk/releases?tab=windows
extract file in C:/src
in
C:/src/flutter/bin
Run:
flutter doctor
This link help you to install Flutter:
https://www.aparat.com/v/Da9IN/%D8%A2%D9%85%D9%88%D8%B2%D8%B4_%DA%A9%D8%A7%D9%85%D9%84_%D9%86%D8%B5%D8%A8_flutter
If in your system antivirus or firewall is there then mostly its due to that. try after suspending antivirus and firewall
You also have one option directly download stable version from here - https://flutter.dev/docs/development/tools/sdk/releases

build of MobileVLC for iOS fails

I'm trying to compile VLC player for iOS.
I've cloned git from repo, a tried to run "buildMobileVLC.sh" (using this wiki documentation)
$ git clone git://git.videolan.org/MobileVLC.git
$ cd MobileVLC
$ ./buildMobileVLC.sh
But as the result I have in terminal next:
SDKROOT not specified, assuming /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
*** /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk does not exist, please install required SDK, or set SDKROOT manually. ***
Even this
./buildMobileVLC.sh -k iphoneos5.0
can't help to solve the problem
P.S. When I try:
./buildMobileVLC.sh -h
It says
-k Specify which sdk to use (see 'xcodebuild -showsdks', current: iphoneos5.0)
What am I doing wrong? And should I install iPhone SDK 5.1, if "yes", then how?
UPD:
I changed
SDK_VERSION=5.0
in file "build.sh" in /Users//MobileVLC/ImportedSources/vlc/extras/package/ios
The error disappeared but the new error in Terminal is:
./libavutil/arm/asm.S:180:cannot use register index with PC-relative addressing -- `ldr r4,[pc,r4]'
./libavutil/arm/asm.S:180:cannot use register index with PC-relative addressing -- `ldr lr,[pc,lr]'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libavcodec/arm/ac3dsp_armv6.o] Error 1
make: *** [.ffmpeg] Error 2
Yes you should install the iOS SDK, you can get it by installing Xcode from the Appstore.
Error is telling you that the SDK can not be found, after you install Xcode the SDK will be installed.
With the new Xcode the SDK is in the Xcode bundle, /Applications/Xcode.app/Contents/Developer
As suggest you could set the SDKROOT to this path if it can't find the SDK.
It appears that the mobile build for VLC is broken: http://forum.videolan.org/viewtopic.php?f=12&t=103322