离子不会在设备上运行

时间:2018-01-19 16:10:46

标签: android cordova android-studio ionic-framework

我正在尝试运行一个Ionic例程,但我无法让它与run和emulate一起运行。 我可以在我的设备中运行一些Android Studio示例而没有问题,并且可以使用$ ionic serve运行它但是当我尝试使用run android运行它时,答案是:

$ ionic cordova run android --device
Running app-scripts build: --platform android --target cordova
[13:54:25]  build dev started ... 
[13:54:25]  clean started ... 
[13:54:25]  clean finished in 8 ms 
[13:54:25]  copy started ... 
[13:54:25]  deeplinks started ... 
[13:54:25]  deeplinks finished in 59 ms 
[13:54:25]  transpile started ... 
[13:54:31]  transpile finished in 5.63 s 
[13:54:31]  preprocess started ... 
[13:54:31]  preprocess finished in 1 ms 
[13:54:31]  webpack started ... 
[13:54:31]  copy finished in 6.18 s 
[13:54:39]  webpack finished in 8.41 s 
[13:54:39]  sass started ... 
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[13:54:41]  sass finished in 1.72 s 
[13:54:41]  postprocess started ... 
[13:54:41]  postprocess finished in 24 ms 
[13:54:41]  lint started ... 
[13:54:41]  build dev finished in 16.39 s 
> cordova run android --device
Android Studio project detected

ANDROID_HOME=/Users/<user>/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
chmod: File not found: /Users/<me>/cutePuppyPics/platforms/android/gradle/wrapper/gradle-wrapper.properties

sed: no such file or directory: /Users/<me>/cutePuppyPics/platforms/android/gradle/wrapper/gradle-wrapper.properties

(node:10706) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /Users/<me>/cutePuppyPics/platforms/android/gradlew: Command failed with exit code ENOENT
(node:10706) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?

[13:54:46]  lint finished in 5.50 s

正在运行cordova requirements它告诉我我安装了gradle:

$ cordova requirements
Android Studio project detected

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-27,android-26,android-24,android-23
Gradle: installed /usr/local/lib/node_modules/gradle/bin/gradle

非常感谢! :)

2 个答案:

答案 0 :(得分:0)

可能需要更新您的gradle配置,以便您可以尝试此操作。

TypeError: mdb.runCommand is not a function

答案 1 :(得分:0)

  1. 从项目目录中删除所有.gradle文件。
  2. 添加android平台。如果存在rm并再次添加。 cordova平台添加android@6.3.3
  3. 再次尝试使用cordova构建。
  4. 取得成功