Android Emulator Setup for Salesforce
Setting up android emulator for salesforce
Pre-requisites:
- SFDX CLI
- VS code with Salesforce & SFDX extensions
Step1: Install/update required SFDX plugins.
- sfdx plugins:install @salesforce/lwc-dev-server
- sfdx plugins:install @salesforce/lwc-dev-mobile
- sfdx plugins:update
Step2: Download & Install Android Studio.
Step3: Additional downloads to complete Android Studio setup.
- Android Studio | Configure | SDK Manager: download at least one SDK
Platform from API levels 23 through 29 (install at least latest 3 version or
as per requirement)
- Android Studio | Configure | AVD Manager: download at least 1 system
image that supports API 29 and Google APIs (create a dummy virtual device to
get to Images screen)
- Create a Virtual Device:
Check below links for a detailed stepwise guide: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.mobile_extensions_setup_android_studio
Step4: Set up 'Environment Variables'.
- ANDROID_HOME = C:\Users\<user>\AppData\Local\Android\Sdk
- JAVA_HOME = C:\Program Files\Android\Android Studio\jre
Step6: Using AVDs for testing.
- Specific component testing (launched in android device's default browser)
- Start a Local LWC server: sfdx force:lightning:lwc:start
- Preview component in emulated device: - sfdx force:lightning:lwc:preview -p android -n component_name [-t target_AVD_name]
- Test using Salesforce App.
- Install Salesforce App on the AVD from play-store (may need to enable
play-store first, if using a google_api image as per step#3)
Open AVD on disk and update below lines in the 'config' file to enable playstore.
- PlayStore.enabled=false to PlayStore.enabled=true
- image.sysdir.1=system-images\android-29\google_apis\x86_64\ to image.sysdir.1=system-images\android-29\google_apis_playstore\x86_64\
- tag.id=google_apis to tag.id=google_apis_playstore
- Launch and log-in SF app with environment specific credential.
- Check desired Functionality.
- Install Salesforce App on the AVD from play-store (may need to enable
play-store first, if using a google_api image as per step#3)
Comments
Post a Comment