23

i am new to ionic and i start basic tabs project using ionic cli. Everything is working fine, except when i tried "ionic cordova run android" command with redmi note 4 giving following error.

Error: Failed to execute shell command "input,keyevent,82"" on device: Error: adb: Command failed with exit code 137

it is working fine on redmi note 3, follow is log from terminal, Any help would be appreciated

[INFO] Running app-scripts build: --platform android --target cordova

[23:22:39]  build dev started ... 
[23:22:39]  clean started ... 
[23:22:39]  clean finished in 6 ms 
[23:22:39]  copy started ... 
[23:22:39]  deeplinks started ... 
[23:22:39]  deeplinks finished in 64 ms 
[23:22:39]  transpile started ... 
[23:22:45]  transpile finished in 5.99 s 
[23:22:45]  preprocess started ... 
[23:22:45]  copy finished in 6.38 s 
[23:22:46]  preprocess finished in 229 ms 
[23:22:46]  webpack started ... 
[23:23:08]  webpack finished in 22.92 s 
[23:23:08]  sass started ... 
[23:23:12]  sass finished in 3.52 s 
[23:23:12]  postprocess started ... 
[23:23:12]  postprocess finished in 11 ms 
[23:23:12]  lint started ... 
[23:23:12]  build dev finished in 32.98 s 
> cordova run android --device
ANDROID_HOME=/home/rogers/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Subproject Path: CordovaLib
[23:23:18]  lint finished in 5.77 s 
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

        at build_rbfqc9qtl315khhol1quvz1g.run(/home/rogers/workspace/practice/myApp/platforms/android/build.gradle:141)

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild UP-TO-DATE
:preDebugBuild
 UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders

UP-TO-DATE

:CordovaLib:generateDebugAssets

UP-TO-DATE

:CordovaLib:mergeDebugAssets
 UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
 UP-TO-DATE
:CordovaLib:packageDebugRenderscript
 UP-TO-DATE
:CordovaLib:compileDebugRenderscript

UP-TO-DATE

:CordovaLib:generateDebugResValues

UP-TO-DATE

:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources

UP-TO-DATE

:CordovaLib:processDebugManifest
 UP-TO-DATE
:CordovaLib:generateDebugBuildConfig

UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard

UP-TO-DATE

:CordovaLib:compileDebugJavaWithJavac
 UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

UP-TO-DATE

:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug

UP-TO-DATE

:prepareOrgApacheCordovaCordovaLib630DebugLibrary

UP-TO-DATE

:prepareDebugDependencies

:compileDebugAidl

UP-TO-DATE

:compileDebugRenderscript

UP-TO-DATE
:generateDebugBuildConfig
 UP-TO-DATE
:generateDebugResValues
 UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources

UP-TO-DATE

:processDebugManifest

UP-TO-DATE

:processDebugResources

UP-TO-DATE

:generateDebugSources
 UP-TO-DATE

:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac

UP-TO-DATE
:compileDebugNdk

UP-TO-DATE

:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets

UP-TO-DATE

:mergeDebugAssets
 UP-TO-DATE
:transformClassesWithDexForDebug
 UP-TO-DATE
:mergeDebugJniLibFolders
 UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:processDebugJavaRes
 UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
 UP-TO-DATE
:validateSigningDebug
:packageDebug
 UP-TO-DATE
:assembleDebug
 UP-TO-DATE
:cdvBuildDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 3.045 secs
Built the following apk(s): 
    /home/rogers/workspace/practice/myApp/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=/home/rogers/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Skipping build...

Built the following apk(s): 
    /home/rogers/workspace/practice/myApp/platforms/android/build/outputs/apk/android-debug.apk

Using apk: /home/rogers/workspace/practice/myApp/platforms/android/build/outputs/apk/android-debug.apk

Package name: io.ionic.starter

Error: Failed to execute shell command "input,keyevent,82"" on device: Error: adb: Command failed with exit code 137

[ERROR] An error occurred while running cordova run android --device (exit code 1).
Mohit Patil
  • 436
  • 1
  • 5
  • 15
  • If someone having the same problem. so try this, it happened because RSA key dialog didn't appear when I connect the device to the system. I turn on/off developer mode couple of times and it appeared. – Mohit Patil Jan 12 '18 at 15:04

6 Answers6

89

this is a Xiaomi "Security" issue. You have to activate the "USB Debugging (Security settings)" in the developer options.

I hope this works for you as it worked for me :D

Pradas
  • 1,023
  • 6
  • 7
  • 2
    Yea i did i ready but that was not it. It was RSA key dialog not appeared, when i connect the device. I turn on/off developer mode couple of times and it appeared. By the way thanks for help. – Mohit Patil Oct 18 '17 at 14:14
  • The answer and the first comment worked for me. Great – Shoshi Mar 13 '18 at 05:13
  • 5
    Worst phone brand for developers – Mehdiway Sep 21 '18 at 01:19
  • 1
    I was exclusively searching for this issue on Xiaomi devices. Thanks, I could use USB debugging on those devices too, now. – vss Feb 12 '19 at 06:16
27

Turn these bit

Turn On these both as shown in the Screenshot. For MI phones dont't forget to enable USB debugging (Security settings)

bunny
  • 1,316
  • 2
  • 13
  • 22
8

For MI phones dont't forget to enable USB debugging (Security settings)

Debojyoti
  • 4,503
  • 3
  • 19
  • 27
1

First remove the android platform and add it again. Use these 2 commands.one by one

1.ionic platform remove android. 2.ionic platform add android.

It works for me.

krish
  • 131
  • 1
  • 1
  • 9
0

Since we're constantly reinstalling the app by copying it from the Ionic CLI to the device, there are couple of issues that I found that resulted the above's issue:

  1. The app's version is lower than the one you try to install
  2. uninstall the app - and try again
  3. Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user] means that the USB debugging is either off or on, but the "installed via USB" is off ...
Ricky Levi
  • 7,298
  • 1
  • 57
  • 65
-1

if you don't have enough space on the phone make sure to make a space on your storage

check the storage of the device if have enough storage is good. else free some space. after that re-run the command if isn't become successful, please check another device, the problem is that device

Abdi Abdi
  • 11
  • 6
  • this could be a comment. Stackoverflow answers should contain a potential solution not just suggestions like try another device or free up space. – Khaleel Oct 29 '20 at 12:35