我是离子新手,我使用离子cli启动基本标签项目。一切都运行正常,除非我尝试使用redmi note 4的“ionic cordova run android”命令给出以下错误。
错误:无法在设备上执行shell命令“input,keyevent,82”“:错误:adb:命令失败,退出代码为137
它在redmi note 3上正常工作,以下是来自终端的日志,任何帮助将不胜感激
[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).
答案 0 :(得分:64)
这是小米"安全"问题。您必须激活" USB调试(安全设置)"在开发者选项中。
我希望这适合你,因为它对我有用:D
答案 1 :(得分:3)
对于MI手机,请不要忘记启用 USB调试(安全设置)
答案 2 :(得分:0)
首先删除android平台,然后再次添加。 使用这2个命令。
1.ionic平台删除android。 2.ionic平台添加android。
对我有用。
答案 3 :(得分:0)
由于我们一直在通过将应用程序从Ionic CLI复制到设备来不断地重新安装该应用程序,因此我发现了导致上述问题的几个问题:
Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
表示USB调试已打开或关闭,但“通过USB安装”已关闭... 答案 4 :(得分:0)
答案 5 :(得分:-1)
如果手机上没有足够的空间,请确保在存储空间中留出空间
如果有足够的存储空间,请检查设备的存储空间。 否则释放一些空间。 重新执行命令后,如果未成功,请检查另一台设备,问题在于该设备