下载的可执行文件无法在主机上执行

Posted

技术标签:

【中文标题】下载的可执行文件无法在主机上执行【英文标题】:Downloaded executables cannot execute on host 【发布时间】:2017-10-23 22:08:23 【问题描述】:

说明

我正在尝试构建运行 flutter create 后创建的默认应用程序,并不断收到如下所示的 gradle 错误。类路径可能最初是在 android\builde.gradle 中设置的,但下面提到的行是完全相同的。 在可能相关的注释中,flutter doctor 仍然显示消息 X Downloaded executables cannot execute on host。我最初解决了我认为导致它的问题here,但显然它仍然是一个问题并且可能与这个问题有关。

日志

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\DaVucci\Desktop\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 24

* What went wrong:
A problem occurred evaluating script.
> Cannot change dependencies of configuration 'classpath' after it has been resolved.

颤振医生

[√] Flutter (on Microsoft Windows [Version 10.0.15063], channel alpha)
    • Flutter at C:\Users\DaVucci\Desktop\flutter
    • Framework revision 973304d5fb (4 days ago), 2017-05-18 17:31:57 -0700
    • Engine revision f99d3ef108
    • Tools Dart version 1.23.0-dev.11.11
    X Downloaded executables cannot execute on host (see https://github.com/flutter/flutter/issues/6207 for more information)

[√] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at C:\Users\DaVucci\AppData\Local\Android\sdk
    • Platform android-25, build-tools 25.0.3
    • ANDROID_HOME = C:\Users\DaVucci\AppData\Local\Android\sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[√] Android Studio (version 2.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Gradle version 3.2
    • Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[√] IntelliJ IDEA Ultimate Edition (version 2017.1)
    • Dart plugin version 171.4424
    • Flutter plugin version 13.1

[-] WebStorm (version 2017.1)
    • Flutter plugin not installed; this adds Flutter specific functionality.
    • For information about managing plugins, see
      https://www.jetbrains.com/help/idea/managing-plugins.html

[√] Connected devices
    • Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 6.0 (API 23) (emulator)

颤振构建-v apk

C:\Users\DaVucci\IdeaProjects\test_flutter>flutter build -v apk
[  +16 ms] [C:\Users\DaVucci\Documents\Flutter\flutter\] git rev-parse --abbrev-ref --symbolic @u
[  +51 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @u
[        ] origin/alpha
[        ] [C:\Users\DaVucci\Documents\Flutter\flutter\] git ls-remote --get-url origin
[  +39 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[        ] [C:\Users\DaVucci\Documents\Flutter\flutter\] git log -n 1 --pretty=format:%H
[  +39 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 973304d5fbf737510ecc250b93d9ee2e872b563f
[        ] [C:\Users\DaVucci\Documents\Flutter\flutter\] git log -n 1 --pretty=format:%ar
[  +38 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[        ] 6 days ago
[ +349 ms] Using gradle from C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle.bat.
[   +5 ms] Running 'gradle assembleRelease'...
[   +1 ms] [android\] C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle.bat -Ptarget=lib/main.dart assembleRelease
[+3066 ms] Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
[+2948 ms] Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
[   +2 ms] java.lang.IllegalStateException: buildToolsVersion is not specified.
[        ]      at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
[        ]      at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:645)
[        ]      at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:608)
[        ]      at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:605)
[        ]      at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
[        ]      at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)
[        ]      at com.android.build.gradle.BasePlugin.lambda$createTasks$1(BasePlugin.java:603)
[        ]      at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
[        ]      at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
[        ]      at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
[        ]      at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
[        ]      at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
[        ]      at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
[   +1 ms]      at com.sun.proxy.$Proxy15.afterEvaluate(Unknown Source)
[        ]      at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
[   +5 ms]      at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
[        ]      at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:573)
[        ]      at org.gradle.api.internal.project.DefaultProject.evaluationDependsOn(DefaultProject.java:645)
[        ]      at org.gradle.api.internal.project.DefaultProject.evaluationDependsOn(DefaultProject.java:637)
[        ]      at org.gradle.api.Project$evaluationDependsOn.call(Unknown Source)
[        ]      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
[        ]      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
[        ]      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
[        ]      at build_7166dkraqy4b74kijpr84q9ba$_run_closure2.doCall(C:\Users\DaVucci\IdeaProjects\test_flutter\android\build.gradle:20)
[        ]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[        ]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[        ]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[        ]      at java.lang.reflect.Method.invoke(Method.java:498)
[        ]      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
[        ]      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
[        ]      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
[        ]      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
[   +2 ms]      at groovy.lang.Closure.call(Closure.java:414)
[        ]      at groovy.lang.Closure.call(Closure.java:430)
[        ]      at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
[        ]      at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
[        ]      at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
[        ]      at org.gradle.api.internal.project.DefaultProject.configure(DefaultProject.java:921)
[        ]      at org.gradle.api.internal.project.DefaultProject.configure(DefaultProject.java:926)
[        ]      at org.gradle.api.internal.project.DefaultProject.subprojects(DefaultProject.java:909)
[        ]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[        ]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[        ]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[        ]      at java.lang.reflect.Method.invoke(Method.java:498)
[        ]      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
[        ]      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
[        ]      at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:382)
[        ]      at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:170)
[        ]      at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
[        ]      at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
[        ]      at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)
[        ]      at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:83)
[        ]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[   +1 ms]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[        ]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[        ]      at java.lang.reflect.Method.invoke(Method.java:498)
[        ]      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
[        ]      at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:941)
[        ]      at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1264)
[        ]      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217)
[        ]      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
[        ]      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
[        ]      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
[        ]      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
[        ]      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
[        ]      at build_7166dkraqy4b74kijpr84q9ba.run(C:\Users\DaVucci\IdeaProjects\test_flutter\android\build.gradle:18)
[        ]      at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
[        ]      at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:176)
[        ]      at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
[        ]      at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:181)
[        ]      at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
[        ]      at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
[        ]      at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
[   +2 ms]      at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
[        ]      at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:573)
[        ]      at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125)
[        ]      at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
[        ]      at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
[        ]      at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:162)
[        ]      at org.gradle.internal.Factories$1.create(Factories.java:25)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
[        ]      at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159)
[        ]      at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:36)
[        ]      at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:118)
[        ]      at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
[        ]      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
[        ]      at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
[   +2 ms]      at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:98)
[        ]      at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
[        ]      at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
[        ]      at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
[        ]      at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
[        ]      at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
[        ]      at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
[        ]      at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
[        ]      at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
[        ]      at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
[        ]      at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
[        ]      at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[   +1 ms]      at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
[        ]      at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
[        ]      at org.gradle.util.Swapper.swap(Swapper.java:38)
[        ]      at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
[        ]      at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[        ]      at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
[        ]      at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
[        ]      at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
[   +1 ms]      at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
[   +1 ms]      at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293)
[        ]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
[        ]      at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
[        ]      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[        ]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[        ]      at java.lang.Thread.run(Thread.java:745)
[        ] FAILURE: Build failed with an exception.
[        ] * Where:
[        ] Script 'C:\Users\DaVucci\Documents\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 24
[        ] * What went wrong:
[        ] A problem occurred evaluating script.
[        ] > Cannot change dependencies of configuration 'classpath' after it has been resolved.
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[   +1 ms] BUILD FAILED
[        ] Total time: 5.948 secs
[ +416 ms] "flutter apk" took 6,812ms.
Gradle build failed: 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:29)
#1      buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:244)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:192)
<asynchronous suspension>
#3      buildApk (package:flutter_tools/src/commands/build_apk.dart:83)
<asynchronous suspension>
#4      BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:55)
<asynchronous suspension>
#5      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:210)
<asynchronous suspension>
#6      BuildSubCommand.verifyThenRunCommand (package:flutter_tools/src/commands/build.dart:50)
<asynchronous suspension>
#7      FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:156)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:194)
<asynchronous suspension>
#9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:261)
<asynchronous suspension>
#10     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
#11     Future.Future.sync (dart:async/future.dart:208)
#12     CommandRunner.run (package:args/command_runner.dart:109)
#13     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:156)
#14     run.<anonymous closure> (package:flutter_tools/executable.dart:140)
<asynchronous suspension>
#15     AppContext._run (package:flutter_tools/src/base/context.dart:76)
<asynchronous suspension>
#16     AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
#17     _rootRun (dart:async/zone.dart:1120)
#18     _CustomZone.run (dart:async/zone.dart:1001)
#19     runZoned (dart:async/zone.dart:1465)
#20     AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
#21     run (package:flutter_tools/executable.dart:113)
<asynchronous suspension>
#22     main (package:flutter_tools/executable.dart:66)
<asynchronous suspension>
#23     main (file:///C:/Users/DaVucci/Documents/Flutter/flutter/packages/flutter_tools/bin/flutter_tools.dart:16)
#24     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
#25     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)


[   +5 ms] exiting with code 1

【问题讨论】:

【参考方案1】:

看起来你是在 Windows 上,对吧?

您可以尝试在包含您的应用程序的目录内的命令提示符中运行flutter build -v apk 吗?

【讨论】:

将输出添加到操作中

以上是关于下载的可执行文件无法在主机上执行的主要内容,如果未能解决你的问题,请参考以下文章

在Linux PC上查看arm交叉编译的可执行文件依赖的动态库

指定的任务可执行文件“cmd.exe”无法运行。指定的可执行文件不是此操作系统平台的有效应用程序

cx_Freeze 生成的可执行文件无法打开

为啥 Git Bash 不能运行我的可执行文件?

使用 Clang 编译的可执行文件中的 emscripten

为啥 Git Bash 不能运行我的可执行文件?