4 | Appium Step by Step | How to create Android Virtual Device
Вставка
- Опубліковано 10 чер 2024
- Android Virtual Device (AVD) Setup for Automation
00:00 Intro
00:56 How to create and start AVD (emulator) with Android Studio GUI App
02:17 On Android Studio goto Virtual Device Manager > Create new virtual device
03:18 Select device configuration and hardware (name, RAM, storage etc.)
13:31 Check the emulator is available in Device Manager
(Device manager will show all connected devices, virtual and physical)
14:11 Start Stop Android Virtual Device (AVD)
16:40 How to create and start AVD (Emulator) without Android Studio
17:15 Set ANDROID_HOME and PATH env variables Ref: • 2 | Appium Step by Ste...
20:53 Run commands
$ sdkmanager.bat --list
Use sdkmanager to get required packages like platform-tools, platforms, build-tools
This can be done in a single command e.g.
$ sdkmanager.bat “platform-tools” "platforms;android-33" “build-tools;33.0.0”
// 33 is the API level of your android device os
Or can be done in separate commands, e.g.
$ sdkmanager.bat "build-tools;33.0.0"
$ sdkmanager.bat "platforms;android-33"
Get the system image that you want to use for the AVD (Android Virtual Device)
$ sdkmanager.bat "system-images;android-33;google_apis;x86_64"
$ sdkmanager.bat "sources;android-33" (can skip this)
All these folders should automatically go in the ANDROID_HOME folder, else you can manually place them there
Add path of folders platforms, platform-tools and emulator in Path env variable
32:35 Use avdmanager commands to create AVD
(available in cmdline-tools/bin, same place where sdkmanager is)
avdmanager
avdmanager list
avdmanager list avd
avdmanager create avd -n MyAVD1 -k “system-images;android-33;google_apis;x86_64”
Here
-n is the name of the AVD, we can give any name as you like, can also use --name
-k is the system image that we downloaded using sdkmanager above, can also use --package
(using this command - sdkmanager "system-images;android-33;google_apis;x86_64" )
Can also give the id in -d flag
avdmanager create avd -n MyAVD1 -d 17 -k “system-images;android-33;google_apis;x86_64”
The id for a specific device can be referred by running avdmanager list
37:46 Start AVD using emulator commands
emulator -list-avds
emulator -avd MyAVD1
Can also start AVD with a specific resolution (size) using -skin option
emulator -avd MyAVD1 -skin 450x750
On Mac with Apple M1 M2 chip we can get system images with ARM64 architecture
system-images;android-UpsideDownCakePrivacySandbox;google_apis_playstore;arm64-v8a
49:56 Other options to use Android Virutal Device (emulators)
50:26 Cloud Devices
52:44 Next Steps
Document - docs.google.com/document/d/e/...
All Free Tutorials 🟢 AutomationStepByStep.com/
how to create avd (android emulators) on windows
how to create avd (android emulators) on mac os
how to use sdkmanager
how to use avdmanager
Commands to create android emulator
All Parts - • Appium 2 Beginner Tuto...
▬▬▬▬▬▬▬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬▬
Thankyou so much sir , great work
Most welcome
the video very beautiful, very well, thank you for sharing
Most welcome
Hi Raghav, thanks for the series.
There are only 4 videos on this series. When do we get remaining 3 videos. I am looking for iOS setup
The three remaining videos will come this week and I will start on iOS setup from next week
super !!
Thanks
Thank you raghavan. I am unable to open UI automator in Mac. Getting error as "SWT folder '/opt/homebrew/Caskroom/android-sdk/4333796/tools/lib/aarch64' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar for your platform." Could you please help on this
Nekkanti
Let's troubleshoot this step by step:
1. Verify Android SDK Installation:
- First, ensure that you have the Android SDK installed on your Mac. You can download it from the official Android Studio website.
- Make sure you've set up the `ANDROID_HOME` environment variable correctly. This variable should point to the location where your Android SDK is installed.
2. Check the Location of SWT Folder:
- The error message indicates that the SWT folder is missing. Let's verify its location.
- Open a terminal window and run the following command to find the location of the `swt.jar` file:
```
find /opt/homebrew/Caskroom/android-sdk/ -name swt.jar
```
- If the file is found, note down its path.
3. Export ANDROID_SWT Environment Variable:
- Export the `ANDROID_SWT` environment variable to point to the folder containing `swt.jar`. Replace `` with the actual path you found in step 2:
```
export ANDROID_SWT=
```
- You can add this line to your shell profile (e.g., `.bashrc`, `.zshrc`, or `.profile`) to make it persistent across terminal sessions.
4. Restart UI Automator:
- Close any open instances of UI Automator.
- Open a new terminal window and try running UI Automator again:
```
uiautomatorviewer
```
- If everything is set up correctly, the UI Automator Viewer should launch without errors.
5. Additional Troubleshooting:
- If you're still facing issues, consider the following:
- Check if there are any updates available for Android SDK or UI Automator.
- Verify that your Android SDK installation is complete and up to date.
- Ensure that your Java Development Kit (JDK) is also properly configured.
Remember to replace `` with the actual path to the `swt.jar` file
hi @ragav i'm getting PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host. , what should i do now ?
Nazra
The error message you're encountering indicates that the AVD's CPU architecture 'arm64' is not supported by the QEMU2 emulator on an x86_64 host.
Try using a emulator with different CPU architecture (other than ARM)
Let's break down the situation and explore possible solutions:
1. Emulator Limitations:
- ARM64 emulation on an x86_64 host is currently only possible up to API level 27 (Oreo)
- Unfortunately, newer Android versions (such as Android 31) with ARM64 architecture cannot be directly emulated on an x86_64 host.
2. Workarounds:
- While running ARM64 apps on an x86_64 host is challenging, here are some workarounds you can consider:
a. Use Older System Images:
- Create an AVD using an older system image (e.g., Android 27 or earlier) that supports ARM64 emulation.
- Keep in mind that using older system images may limit access to newer features and APIs.
b. Include x86_64 Binaries:
- If your app includes native libraries (e.g., C or C++), ensure that you have binaries for both ARM64 (arm64-v8a) and x86_64 architectures.
- The APK's `lib` directory should contain folders for both `arm64-v8a` and `x86_64`.
- If you don't have x86_64 binaries, consider obtaining or building them and including them in your APK¹.
c. Run on Physical Devices:
- If possible, test your app on physical devices with ARM64 CPUs. Physical devices provide accurate testing environments for specific architectures.
d. CPU Host Flag:
- When launching the emulator, consider adding the `-cpu host` flag to the `qemu-system-x86_64` command.
- For example:
```
qemu-system-x86_64 -m 4000 -vga virtio -accel hvf -usb -device usb -tablet -drive file=ubuntu.qcow2,if=virtio -cpu host
```
- This flag allows the emulator to use the host's CPU capabilities, which might improve compatibility³.
3. Future Considerations:
- Keep an eye on updates to the Android Emulator and QEMU. Newer versions may improve ARM64 emulation support on x86_64 hosts.
Remember that emulating ARM64 on an x86_64 host has limitations, so choose the best approach based on your specific requirements
please upload remaining videos
Sure Nekkanti, next video coming tomorrow.
hi ragav , i'm facing a new issue for UpsideDownSand i don't have arm 64 , is it okay to fetch another virtual device which is contain arm64 ? ( for me showing Vannila Icecrem arm 64 )
Yes Nazra, check OS of your system and accordingly create the Virtual Device. I used ARM as I was using Mac os with apple m2 chip
@@RaghavPal I think its better to upload for windows as well I'm still stuck on that part got so panic error in cmd
oh.. got that.. I believe i had mentioned it while recording..
@@RaghavPal yes , you've mentioned but not in windows ? Can you add a new vdo in windows also . Please sir
okay.. i will check
please when are you uploading the sixth and seventh videos
Martins, 6th video is coming this Thursday and next very soon