将Ionic应用程序部署到Android Phone(Ionic 4)时出错

时间:2019-05-20 14:49:24

标签: android cordova ionic-framework gradle android-gradle

我正在运行ionic cordova run android命令,并按预期连接了USB电缆。该应用程序将构建,然后在开始构建将apk部署到我的手机上时,我在终端中遇到此错误。

> cordova run android Android Studio project detected ANDROID_HOME=/Users/user/Library/Android/sdk JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home studio Subproject Path: CordovaLib Subproject Path: app publishNonDefault is deprecated and has no effect anymore. All variants are now published. 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_3e7pv4o3p5wholih0470cvjae.run(/Users/user/Documents/BoutiqueSolicitors/BoutiqueSolicitors/platforms/android/app/build.gradle:148) Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl FAILED

FAILURE: Build failed with an exception.

* What went wrong: null value in entry: incrementalFolder=null

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s 1 actionable task: 1 executed /Users/user/Documents/BoutiqueSolicitors/BoutiqueSolicitors/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

* What went wrong: null value in entry: incrementalFolder=null

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s [ERROR] An error occurred while running subprocess cordova.

        cordova run android exited with exit code 1.

我查找了错误:incrementalFolder = null,发现有人说要修复此错误,您需要删除现有android studio项目根目录下的.gradle文件夹。我没有做任何尝试。

有人知道这个解决方法吗?我一无所知,我们将不胜感激。

1 个答案:

答案 0 :(得分:1)

  1. 子项目路径:CordovaLib子项目路径:app publishNonDefault已弃用,不再起作用。所有变体现已发布。----------->无影响。

  2. Task.leftShift(Closure)方法已被弃用,并计划在Gradle 5.0中删除。请改用Task.doLast(Action)。----------->没有影响。

  3. 在build_3e7pv4o3p5wholih0470cvjae.run中的
  4. (/Users/user/Documents/BoutiqueSolicitors/BoutiqueSolicitors/platforms/android/app/build.gradle:148)不建议在项目':app'中使用配置'compile'。请改用“实现”。 ---------->修改app / build.gradle中的依赖项以使用“实现”而不是“编译”。

  5. :CordovaLib:preBuild UP-TO-DATE:CordovaLib:preDebugBuild UP-TO-DATE:CordovaLib:compileDebugAidl FAILED。例如辅助界面的定义和位置。

从android studio终端运行命令'gradlew assembleDebug --debug',看看它是否提供有关构建失败的更多详细信息。

enter image description here

enter image description here

[2]: https://i.stack.imgur.com/jJQRg.png