使用 Cordova 开发我可以在 Windows 10 上使用 Android Studio 并在 Windows 上同时使用 Ubuntu 吗?

Developing with Cordova can I use Android Studio on Windows 10 and Ubuntu for Windows together?

需要一些关于我的安装和了解两者如何集成的帮助——如果有的话…… 我已经在 Windows 10 上安装了 Android Studio,打开了 WSL(Windows 用于 Linux 的子系统),为 Windows 安装了 Ubuntu 并使用命令行安装了所有好的支持工具,如 Cordova、Gradle、SDKMANAGER 等。想知道我是否需要为 Ubuntu 安装 Android Studio 而不是使用 Windows 版本这样我就可以两全其美了。

由于针对已弃用的组件以及位置和环境变量的安装差异,我的环境出现了很多问题。但是,在旅途中学到了很多。

enter image description here

当我查看 Ubuntu 的 $PATH 时,有 Windows 个位置的引用。所以我假设发生了一些交互,但知道 Windows 不能修改 Ubuntu(Linux) 文件或文件夹的文件权限...

**Some entries in Ubuntu/Linux PATH variable...
/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_2004.2020.424.0_x64__79rhkp1fndgsc:
/mnt/c/Program Files/Java/jdk-14.0.2/bin:
/mnt/c/Python38/Scripts/:
/mnt/c/Python38/:
/mnt/c/Windows/system32:
/mnt/c/Users/Admin/AppData/Local/atom/bin:
/mnt/c/Users/Admin/AppData/Roaming/npm:
/usr/lib/android-sdk/platform-tools:**

所以我在以下位置安装了Ubuntu Android-sdk...

**/usr/lib/android-sdk**

link 我觉得很有趣 - Android SDK 可以安装在多个位置 - 是的,这很有用。

并且 Windows 使用...

**C:\Users\Admin\AppData\Local\Android\Sdk**

Android Studio (Windows)

一旦您了解了这个过程,命令行就会提供超级强大和快速的结果。而且,Windows 提供了强大的 GUI 支持和更易于管理的界面。我希望他们能 运行 在一起,有人可以解释,因为那里有很多或相互矛盾的信息。

我实际上刚刚注意到 Android 目标的 Cordova 要求现在显示已安装 android-28(原为 Android 目标:未安装) - 我之前无法解决这个问题,但是一旦我完成了这段旅程,我就会 post 我日记中的项目来帮助其他人。

我建议你不要那样做。因为 linux 的 Android SDK 不同于 windows 的 android SDK。因此 windows 中的 andorid 工作室将永远无法与 linux 的 android sdk 正常工作。此外,WSL linux 不应用于稳定 android 开发,因为 windows 仅管理为 Windows OS 配置的大部分组件。 如果你真的想更好地控制你想输入的命令,我的建议是使用稳定的 linux OS 而不是 windows.