Ionic与Capacitor在IntelliJ中无法运行Android模拟器

4

我运行了 npx doctor 和 npx cap sync 命令。

   Capacitor Doctor   

 Latest Dependencies:

  @capacitor/cli: 2.2.1
  @capacitor/core: 2.2.1
  @capacitor/android: 2.2.1
  @capacitor/electron: 2.2.1
  @capacitor/ios: 2.2.1

Installed Dependencies:

  @capacitor/cli 2.2.1
  @capacitor/core 2.2.1
  @capacitor/android 2.2.1
  @capacitor/ios 2.2.1
  @capacitor/electron not installed

[success] Android looking great! 
  Found 0 Capacitor plugins for ios:
[success] iOS looking great! 
~/projects/private/growbox: ()$ npx cap open android
[info] Opening Android project at /Users//projects/private/growbox/android
~/projects/private/growbox: ()$ npx cap sync  
✔ Copying web assets from mobile to android/app/src/main/assets/public in 5.45s
✔ Copying native bridge in 10.89ms
✔ Copying capacitor.config.json in 8.76ms
✔ copy in 5.50s
✔ Updating Android plugins in 15.83ms
  Found 0 Capacitor plugins for android:
✔ update android in 86.12ms
✔ Copying web assets from mobile to ios/App/public in 5.37s
✔ Copying native bridge in 3.78ms
✔ Copying capacitor.config.json in 4.42ms
✔ copy in 5.41s
✔ Updating iOS plugins in 15.84ms
  Found 0 Capacitor plugins for ios:
✔ Updating iOS native dependencies with "pod install" (may take several minutes) in 26.92s
✔ update ios in 26.98s
✔ copy in 1.30ms
✔ update web in 5.00μp
Sync finished in 38.021s

这是我得到的内容,之后我运行了:npx cap open android
Got: [info] Opening Android project at /Users//projects/private/growbox/android

目前没有任何进展。

我已经运行模拟器,一切都安装好了,使用的是最新版的IntelliJ Ultimate。

2个回答

4

如何手动打开它?没有手动运行项目的示例。你能否给我提供参考或代码来完成吗? - hackp0int
1
android文件夹包含一个Android项目,因此您可以像在IntelliJ中打开Android项目一样打开它。 - jcesarmobile

1

如果你正在使用Linux(Windows除外),要在IntelliJ Ultimate中打开,请简单地编辑capacitor.config.json文件,并将linuxAndroidStudioPath作为另一个JSON文件的顶级属性添加:

{
     "appId": "com.foo.app",
     "appName": "FooBar",
     "bundledWebRuntime": false,
 ...
     "linuxAndroidStudioPath": "/opt/idea-IU-201.7846.76/bin/idea.sh"
}

运行
npx cap open android

如果IntelliJ已经打开,则会出现熟悉的对话框,以在当前窗口或新窗口中打开。
如果您正在运行Windows,则看起来选项是windowsAndroidStudioPath。
Windows参数取自电容器配置页面

谢谢你的回答,我正在使用Mac OSX,你能帮忙吗? - hackp0int
@IamStalker 在追寻源代码时,看起来代码在过去的3天里已合并到主干,并且现在使用了STUDIO_PATH环境变量。就发行方面而言(例如,如果它是GA版本),我不知道这意味着什么?在接下来的一周里,我将检查并相应更新我的答案。如果您有关于它可用于哪个发布版本的任何信息,请告知。 https://github.com/ionic-team/capacitor/blob/d71e6d5e841c68073868c977b0aa1affbab30553/cli/src/config.ts#L167 - Software Prophets
好像是常量变量,没有任何更改。 - hackp0int
你是指 process.env 吗?它可以从你的系统中获取环境变量。当然,你首先需要设置它。https://www.geeksforgeeks.org/node-js-process-env-property/ - Software Prophets

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接