Mobilefirst 8 Cordova插件Android构建失败

时间:2018-12-06 01:54:45

标签: android cordova ibm-mobilefirst

我们创建一个简单的cordova项目

我们的平台信息:

  

cordova cli 6.5.0

     

cordova android平台6.1.2

     

cordova ios平台4.3.1

添加这些插件:

cordova-plugin-mfp@8.0.2018112017
cordova-plugin-mfp-push@8.0.2018101607

执行cli:cordova构建android

然后收到如下所示的构建错误消息

  

总时间:3.451秒错误:   /用户/ DannyYang /桌面/ testCordova /测试/平台/ android / gradlew:   命令失败,退出代码为1错误输出:通知失败   ProjectEvaluationListener.afterEvaluate(),但主要配置   失败优先。 java.lang.IllegalStateException:   未指定buildToolsVersion。在   com.google.common.base.Preconditions.checkState(Preconditions.java:173)     在   com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:645)     在com.android.build.gradle.BasePlugin $ 10.call(BasePlugin.java:608)     在com.android.build.gradle.BasePlugin $ 10.call(BasePlugin.java:605)     在   com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)     在   com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)     在   com.android.build.gradle.BasePlugin.lambda $ createTasks $ 1(BasePlugin.java:603)     在   org.gradle.internal.event.BroadcastDispatch $ ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)     在   org.gradle.internal.event.BroadcastDispatch $ ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)     在   org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)     在   org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)     在   org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)     在   org.gradle.internal.dispatch.ProxyDispatchAdapter $ DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)     在com.sun.proxy。$ Proxy10.afterEvaluate(未知来源)处   org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)     在   org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)     在   org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)     在   org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)     在   org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)     在   org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)     在   org.gradle.initialization.DefaultGradleLauncher $ 2.run(DefaultGradleLauncher.java:124)     在org.gradle.internal.Factories $ 1.create(Factories.java:22)在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)     在   org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)     在   org.gradle.initialization.DefaultGradleLauncher.access $ 200(DefaultGradleLauncher.java:32)     在   org.gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:98)     在   org.gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:92)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)     在   org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)     在   org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController.run(InProcessBuildActionExecuter.java:99)     在   org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)     在   org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)     在   org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)     在   org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)     在   org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)     在   org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74)     在   org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72)     在org.gradle.util.Swapper.swap(Swapper.java:38)处   org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.FoundBuildEnvironment.doBuild(FoundBuildEnvironment.java:72)     在   org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)     在   org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     在   org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50)     在   org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:237)     在   org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)     在   org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)

     

失败:构建失败,并出现异常。

     

我们检查了官方文档(link)

  

cordova-ios:> = 4.1.1和<5.0

     

cordova-android:> = 6.1.2和<= 8.0

     

Apache Cordova CLI(> = 6.x和<9.0)

我们的环境符合前提条件

但是为什么它无法构建?

  

编辑:

     

完整的源代码:

     

https://github.com/DannyYang/MFP_plugin_test

1 个答案:

答案 0 :(得分:1)

我解决了cordova-plugin-mfp-push插件构建失败的问题, 只需修改build.gradle

  1. 将Maven网址替换为google()
  2. 不要通过依赖库使用'+'