简体   繁体   English

无法运行 cordova 运行 android 设备

[英]cannot run cordova run android device

As requested by playstore I'm changing my app API Level (targetSdkVersion) to 31.根据 Playstore 的要求,我将我的应用程序 API Level (targetSdkVersion) 更改为 31。

I have uninstalled API Level 30 from Android Studio and installed API Level 31.我已经从 Android Studio 卸载了 API Level 30 并安装了 API Level 31。

After that I cannot run my app on device anymore for debugging.之后我无法再在设备上运行我的应用程序进行调试。

I'm receiving a message saying "Could not find target matching { type: 'device' }"我收到一条消息说“找不到匹配的目标 { type: 'device' }”

C:\htdocs\app\myapp>cordova run android --device
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\myusr\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: undefined
Reading build config file: C:\htdocs\app\verpro\build.json
Subproject Path: CordovaLib
Subproject Path: app

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 960ms
50 actionable tasks: 50 up-to-date
Built the following apk(s):
        C:\htdocs\app\verpro\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\ncchi\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: undefined
Reading build config file: C:\htdocs\app\verpro\build.json
Could not find target matching { type: 'device' }

Go to device manager and click on physical device in android studio (after routing your device using USB / wireless in the developers mode of your device). Go 到设备管理器并单击 android 工作室中的物理设备(在设备的开发人员模式下使用 USB / 无线路由设备后)。 Once you have clicked on the physical device, you should be able to see the folders from your device populated there.单击物理设备后,您应该能够看到设备中填充的文件夹。 If no, then click on the pair using code / pair using QR code option.如果否,则单击使用代码配对/使用二维码配对选项。 So basically you need to pair your device with the android studio only after which you will be able to use the command cordova run android --verbose所以基本上你需要将你的设备与 android 工作室配对,之后你才能使用命令cordova run android --verbose

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM