Skip to content

Instantly share code, notes, and snippets.

@Try-Parser
Last active March 16, 2024 17:04
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Try-Parser/b7106d941cc9b1c9e7b4c7443a7c3540 to your computer and use it in GitHub Desktop.
Save Try-Parser/b7106d941cc9b1c9e7b4c7443a7c3540 to your computer and use it in GitHub Desktop.
Running emulator without Android Studio in Windows With Flutter

Android Emulator Setup without Android Studio in Windows with Flutter

First Download the Android SDK Commandline Tool only.

https://developer.android.com/studio/

Goto Download Options

Find Commandline tools only Section

Download Windows Platform

After downloading Extract the file into the Directory you want it to be installed

Next goto the tools/bin then execute this commands:

sdkmanager --update
sdkmanager emulator
sdkmanager system-images;android-25;google_apis;x86
sdkmanager extras;android;m2repository
sdkmanager --license
sdkmanager "build-tools;28.0.3" // latest build-tool
sdkmanager platforms;android-28
sdkmanager platform-tools

create the repositories.cfg file in C:\Users<Username>.android

Setting the EvironmentVariables

JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
ANDROID_SDK_ROOT = C:\Users\<Username>\.android\avd
Path = D:\android\tools\bin;D:\android\emulator

Enable the Windows Hypervisor Platform accelerator

Open windows feature
Check the Windows Hypervisor Platform and the reboot 

Checking list of device

avdmanager list device

Creating the AVD

avdmanager create avd -n <name of avd> --device <type of device> -k <system image>
avdmanager create avd -n nexus5x --device "Nexus 5X" -k system-images;android-25;google_apis;x86

Running the Device

emulator <name of the avd>
emulator @nexus5x

Removing AVD

avdmanager delete avd -n <name of avd>
avdmanager delete avd -n nexus5x

With Flutter

Flutter Config

flutter config --android-sdk /path/to/android/sdk
flutter doctor --android-licenses

Running Emulator with Flutter

flutter emulators --launch <emulator name or index>

Wipe Cache Data in AVD under in C:\Users<Username>.android<avd>\config.ini

fastboot.forceColdBoot=yes

JDK 12

curl https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O jaxb/activation.jar
curl https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.4.0-b180830.0438/jaxb-impl-2.4.0-b180830.0438.jar -O jaxb/jaxb-impl.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.2/jaxb-xjc-2.3.2.jar -O jaxb/jaxb-xjc.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb/jaxb-core.jar
curl https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.2/jaxb-jxc-2.3.2.jar -O jaxb/jaxb-jxc.jar
curl https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb/jaxb-api.jar
curl https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar -O jaxb_lib/istack-commons-runtime.jar

Config file sdkmanager.bat & avdmanager.bat

Above @rem Execute avdmanager and @rem Execute sdkmanager

set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\jaxb-api.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\jaxb-core.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\jaxb-impl.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\jaxb-jxc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\jaxb-xjc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\activation.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb\istack-commons-runtime.jar
@lukeplausin
Copy link

Thanks! I also found this useful for Linux

@Muntasir2001
Copy link

Tried for windows, I can't run the commands, any idea?

@bhupiister
Copy link

bhupiister commented Aug 3, 2022

If you want to install image with Playstore, replace the below line
sdkmanager system-images;android-25;google_apis;x86
with
sdkmanager system-images;android-25;google_apis_playstore;x86

@Try-Parser
Copy link
Author

Thanks! I also found this useful for Linux

yes its doable for linux also thanks.

@punixcorn
Copy link

if your on linux need to add quotes to the system-images...

sdkmanager --install "system-images;android-25;google_apis;x86"

for linux systems, dunno of windows else it will give errors

@WickedSs
Copy link

WickedSs commented Mar 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment