Can't connect to android studio emulator with expo project on WSL2/Linux Subsystem , Error: spawn <correct adb location> ENOENT

huangapple go评论86阅读模式
英文:

Can't connect to android studio emulator with expo project on WSL2/Linux Subsystem , Error: spawn <correct adb location> ENOENT

问题

I'm currently trying to develop a react native application using expo, I created and initialized the project using the Expo CLI, and have no problems using the Expo Go app on my own mobile device and connected via a tunneled connection (npx expo start --tunnel).

The issue I'm having now is connecting my sdk correctly to run the expo android script by pressing a in the terminal. The specific error I'm getting in my case is:
Error: spawn /mnt/c/Users/Mo/AppData/Local/Android/sdk/platform-tools/adb ENOENT

I have followed various stack overflow articles and medium articles to get the point where I've correctly set my ANDROID_HOME variable in my .bashrc on my linux distribution. One of the articles mentioned a specific issue that occurs when running tools from linux is that the .exe extension must be added otherwise it will not work, problem is this is handled by expo and I have no idea how to solve this issue.

For context this is what is in my .bashrc

# Android
export ANDROID_HOME="/mnt/c/Users/Mo/AppData/Local/Android/sdk"
export WSLENV=ANDROID_HOME/p

If anyone has found a solution to this problem or knows of a workaround, please let me know!

英文:

I'm currently trying to develop a react native application using expo, I created and initialized the project using the Expo CLI, and have no problems using the Expo Go app on my own mobile device and connected via a tunneled connection (npx expo start --tunnel).

The issue I'm having now is connecting my sdk correctly to run the expo android script by pressing a in the terminal. The specific error I'm getting in my case is:
Error: spawn /mnt/c/Users/Mo/AppData/Local/Android/sdk/platform-tools/adb ENOENT

I have followed various stack overflow articles and medium articles to get the point where I've correctly set my ANDROID_HOME variable in my .bashrc on my linux distribution. One of the articles mentioned a specific issue that occurs when running tools from linux is that the .exe extension must be added otherwise it will not work, problem is this is handled by expo and I have no idea how to solve this issue.

For context this is what is in my .bashrc

# Android
export ANDROID_HOME=&quot;/mnt/c/Users/Mo/AppData/Local/Android/sdk&quot;
export WSLENV=ANDROID_HOME/p

If anyone has found a solution to this problem or knows of a workaround, please let me know!

答案1

得分: 4

I'm going to update with the fix that I found! I ended up coming up with a solution and solving all my problems, albeit may not be the most elegant solution.

This is a common issue on Linux not being able to find the file with the extension, luckily in this case I was able to simply create a copy of adb.exe called just adb which allowed the script to be run properly from my Linux distribution. I also wrote a full guide, documenting the steps if anyone else gets stuck on this same issue!

Full In-Depth Guide

英文:

Instead of removing this post I'm going to update with the fix that I found! I ended up coming up with a solution and solving all my problems, albeit may not be the most elegant solution.

This is a common issue on Linux not being able to find the file with the extension, luckily in this case I was able to simply create a copy of adb.exe called just adb which allowed the script to be run properly from my Linux distribution. I also wrote a full guide, documenting the steps if anyone else gets stuck on this same issue!

Full In-Depth Guide

huangapple
  • 本文由 发表于 2023年6月30日 03:51:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76584216.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定