Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49235

How to test Android apps in Emulator/Device via WSL (Windows Subsystem Linux)

$
0
0

@jasoncartermartin wrote:

Hello, I have been trying for over a week now to figure out how to test Ionic Android apps through WSL (Windows Subsystem Linux). I use WSL for my development environment (Ubuntu version 16.04) with Windows 10, and it has worked great for everything so far except for trying to develop Native Ionic apps and test in Android.

I have installed Android Studio/SDK, Java, and Gradle on both Windows and the Linux Subsystem (as well as installed & configured proper Android environments using sdkmanager), and have tried a combination of using both environments to build and emulate Android apps. Since WSL can launch native Windows executables such as.exe files, in theory I believe this should be possible to do completely via WSL.

However, the only successful method I have found so far is to install the android-sdk in Linux, build the .apk file via ionic cordova build android, and then manually open the emulator on Windows and drag and drop the created .apk file to the emulator to install and run the build. This is quite cumbersome, but so far has been the only method I have found that works.

If I set up my environment to be completely based on the Linux environment, running ionic cordova requirements works successfully and returns the following:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-28,android-27
Gradle: installed /opt/gradle/gradle-5.1.1/bin/gradle

I am also successfully able to build a .apk file. The problem is that I cannot seem to use the emulator, because WSL has no GUI, and I need to be able to use the emulator based in Windows.

If I set up my environment based on Windows (noting that I still need the Java run time environment based in Linux), everything else appears to work but I receive the following error when running ionic cordova build android or ionic emulate android:

Execution failed for task ':CordovaLib:compileDebugAidl'. 
> java.lang.IllegalStateException: aidl is missing

Running ionic cordova requirements with that configuration gives me the following output:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: installed /mnt/c/Program Files/Android/Android Studio/gradle/gradle-4.10.1/bin/gradle

For some reason, with my Windows configuration it does not recognize the Android target (even though it is properly installed), which leads to the ':CordovaLib:compileDebugAidl' error.

Does anybody have any advice on how to test Ionic Android apps with the emulator while using WSL? Thank you!!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>