我正在尝试将ionic 4应用程序仿真到Android Emulator中 所以我运行命令:
sudo ionic cordova emulate android --prod
我收到此错误:
BUILD SUCCESSFUL in 1s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
/Users/esham/Desktop/magazine-app/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/esham/Library/Android/sdk (DEPRECATED)
No emulator images (avds) found.
1. Download desired System Image by running: /Users/esham/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/esham/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
[ERROR] An error occurred while running subprocess cordova.
cordova emulate android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
我可以通过终端运行它们中的任何一个以进行解说emulator @Pixel_2_API_26
这些我拥有的ADV列表: emulator -list-avds
Pixel_2_API_26
Pixel_2_API_28
Pixel_3_API_28
我在运行命令android list avd
时得到:
The following Android Virtual Devices could not be loaded:
Name: Pixel_3_API_28
Path: /Users/esham/.android/avd/Pixel_3_API_28.avd
Error: Google pixel_3 no longer exists as a device
---------
Name: Pixel_2_API_26
Path: /Users/esham/.android/avd/Pixel_2_API_26.avd
Error: Google pixel_2 no longer exists as a device
---------
Name: Pixel_2_API_28
Path: /Users/esham/.android/avd/Pixel_2_API_28_1.avd
Error: Google pixel_2 no longer exists as a device
No emulator images (avds) found.
这些在macOS上的环境设置:
export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools
答案 0 :(得分:0)
如果您运行“ ionic cordova run android”,则默认情况下会自动运行仿真。所以试试看希望它能解决您的问题。首先,您检查您的模拟Android路径,是否正确下载。您运行“离子科尔多瓦资源”,它会检查所有资源是否正常。您是否需要安装任何东西。所以尝试一下。
答案 1 :(得分:0)
我已通过添加public int GetMin(string key, List<Dictionary<string, int>> db)
{
if (db is null) return 0;
return db.SelectMany(d => d).Where(kvp => kvp.Key == key).DefaultIfEmpty().Min(v => v.Value);
}
因此完整的命令将是:
--emulator=amulator_name