cannot run cordova run android device

998 Views Asked by At

As requested by playstore I'm changing my app API Level (targetSdkVersion) to 31.

I have uninstalled API Level 30 from Android Studio and installed 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' }"

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' }
1

There are 1 best solutions below

0
On

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). 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