gpt4 book ai didi

android - Cordova运行错误-找不到安装的生成工具。安装Android构建工具版本19.1.0或更高版本

转载 作者:行者123 更新时间:2023-12-03 06:25:28 25 4
gpt4 key购买 nike

当我通过官方指南安装cordova installation guide在cordova安装和配置后第一次运行cordova-run时,返回了folloe错误:

C:\ProjetosCordova\lsls>cordova run --debug
ANDROID_HOME=C:\Android\tools
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
Subproject Path: CordovaLib
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary
configuration failure takes precedence.
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)
BUILD FAILED

Total time: 1.353 secs

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)
at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:76)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:628)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:129)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:161)
at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:158)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
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)
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)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

FAILURE: Build failed with an exception.

* Where:
Script 'C:\ProjetosCordova\lsls\platforms\android\CordovaLib\cordova.gradle'
line: 64

* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Install the Android build tools version
19.1.0 or higher.
  • 尝试:
    使用--stacktrace选项运行以获取堆栈跟踪。使用--info或-运行
    调试选项以获取更多日志输出。

  • 我尝试了建议的命令,但执行没有更改,并且错误相同。我想运行并生成APK文件,有人可以帮助我吗?

    在我尝试运行 android list sdk --all时,我收到了以下消息:
    C:\Users\octav>android list sdk --all
    **************************************************************************
    The "android" command is deprecated.
    For manual SDK, AVD, and project management, please use Android Studio.
    For command-line tools, use tools\bin\sdkmanager.bat
    and tools\bin\avdmanager.bat
    **************************************************************************

    "android" SDK commands can be translated to sdkmanager commands on a best-effort
    basis.
    (This prompt can be suppressed with the --use-sdk-wrapper commend-line argument
    or by setting the USE_SDK_WRAPPER environment variable)
    Continue? [y/N]:

    跟随“y”:
    build-tools;19.1.0
    Description: Android SDK Build-Tools 19.1
    Version: 19.1.0
    Installed Location: C:\Android\build-tools\19.1.0

    build-tools;20.0.0
    Description: Android SDK Build-Tools 20
    Version: 20.0.0
    Installed Location: C:\Android\build-tools\20.0.0

    build-tools;21.1.2
    Description: Android SDK Build-Tools 21.1.2
    Version: 21.1.2
    Installed Location: C:\Android\build-tools\21.1.2

    build-tools;22.0.1
    Description: Android SDK Build-Tools 22.0.1
    Version: 22.0.1
    Installed Location: C:\Android\build-tools\22.0.1

    build-tools;23.0.1
    Description: Android SDK Build-Tools 23.0.1
    Version: 23.0.1
    Installed Location: C:\Android\build-tools\23.0.1

    build-tools;23.0.2
    Description: Android SDK Build-Tools 23.0.2
    Version: 23.0.2
    Installed Location: C:\Android\build-tools\23.0.2

    build-tools;23.0.3
    Description: Android SDK Build-Tools 23.0.3
    Version: 23.0.3
    Installed Location: C:\Android\build-tools\23.0.3

    build-tools;24.0.0
    Description: Android SDK Build-Tools 24
    Version: 24.0.0
    Installed Location: C:\Android\build-tools\24.0.0

    build-tools;24.0.1
    Description: Android SDK Build-Tools 24.0.1
    Version: 24.0.1
    Installed Location: C:\Android\build-tools\24.0.1

    build-tools;24.0.2
    Description: Android SDK Build-Tools 24.0.2
    Version: 24.0.2
    Installed Location: C:\Android\build-tools\24.0.2

    build-tools;24.0.3
    Description: Android SDK Build-Tools 24.0.3
    Version: 24.0.3
    Installed Location: C:\Android\build-tools\24.0.3

    build-tools;25.0.0
    Description: Android SDK Build-Tools 25
    Version: 25.0.0
    Installed Location: C:\Android\build-tools\25.0.0

    build-tools;25.0.1
    Description: Android SDK Build-Tools 25.0.1
    Version: 25.0.1
    Installed Location: C:\Android\build-tools\25.0.1

    build-tools;25.0.2
    Description: Android SDK Build-Tools 25.0.2
    Version: 25.0.2
    Installed Location: C:\Android\build-tools\25.0.2

    build-tools;25.0.3
    Description: Android SDK Build-Tools 25.0.3
    Version: 25.0.3
    Installed Location: C:\Android\build-tools\25.0.3

    build-tools;26.0.0
    Description: Android SDK Build-Tools 26
    Version: 26.0.0
    Installed Location: C:\Android\build-tools\26.0.0

    build-tools;26.0.1
    Description: Android SDK Build-Tools 26.0.1
    Version: 26.0.1
    Installed Location: C:\Android\build-tools\26.0.1

    当运行 echo %ANDROID_HOME%时:
    C:\Users\octav>echo %ANDROID_HOME%
    C:\Android\tools

    echo %JAVA_HOME%:
    C:\Users\octav>echo %JAVA_HOME%
    C:\Program Files\Java\jdk1.8.0_144

    这是我的道路的一部分:

    path

    最佳答案

    这是一个链接,您可以在其中看到如何设置环境变量:https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#requirements-and-support

    基本上,建议(而且我认为有必要)不仅设置环境变量,而且还将Windows路径下的tools和platform-tools文件夹路径添加到Windows路径中,如下所示:

    设置环境变量

    Cordova的CLI工具需要设置一些环境变量才能正常运行。 CLI将尝试为您设置这些变量,但是在某些情况下,您可能需要手动设置它们。以下变量应更新:

    Set the `JAVA_HOME` environment variable to the location of your JDK installation
    Set the `ANDROID_HOME` environment variable to the location of your Android SDK installation
    It is also recommended that you add the Android SDK's `tools`, `tools/bin`, and `platform-tools` directories to your PATH

    关于android - Cordova运行错误-找不到安装的生成工具。安装Android构建工具版本19.1.0或更高版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46165439/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com