cordova指定版本_android-Cordova:未指定buildToolsVersion(MacOS)

本文档详细记录了解决Cordova在MacOS上构建Android应用时遇到的'buildToolsVersion未指定'错误的过程。作者尝试了设置ANDROID_HOME路径、删除并重新添加Android平台以及检查build.gradle配置,但问题依然存在。最后,文中提到了错误堆栈和当前的环境变量设置,以寻求进一步的解决办法。
摘要由CSDN通过智能技术生成

我在运行cordova build android –release时遇到错误

Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.

java.lang.IllegalStateException: buildToolsVersion is not specified.

似乎未指定buildToolsVersion.

这是cordova使用的Android_Home.

ANDROID_HOME=/usr/local/Caskroom/android-platform-tools/latest

基本上我试图在下面更改此路径,但它没有更改cordova构建中的路径.

我正在使用以下命令来更改路径.

export ANDROID_HOME=/Users/admin/Library/Android/sdk

export PATH=$ANDROID_HOME/platform-tools:$PATH

export PATH=$ANDROID_HOME/tools:$PATH

source .bash_profile

echo $ANDROID_HOME

但这并没有改变科尔多瓦的道路.

请指教.

编辑:我也试图在cordova中删除并添加android平台.

EDIT2

如果我使用相同的终端,则android_home的路径将更改.好像bashrc没有更新.

但是现在我遇到了不同的错误,构建失败了.

platforms/android/src/org/apache/cordova/file/FileUtils.java:15: error: expected

我已经安装了SDK构建工具版本19.1.0、23.0.1和26.0,但仍然出现错误.

编辑3

的build.gradle

apply plugin: 'com.android.application'

buildscript {

repositories {

mavenCentral()

jcenter()

}

// Switch the Android Gradle plugin version requirement depending on the

// installed version of Gradle. This dependency is documented at

// http://tools.android.com/tech-docs/new-build-system/version-compatibility

// and https://issues.apache.org/jira/browse/CB-8143

dependencies {

classpath 'com.android.tools.build:gradle:2.2.3'

}

}

// Allow plugins to declare Maven dependencies via build-extras.gradle.

allprojects {

repositories {

mavenCentral();

jcenter()

}

}

task wrapper(type: Wrapper) {

gradleVersion = '2.14.1'

}

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.

// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html

ext {

apply from: 'CordovaLib/cordova.gradle'

// The value for android.compileSdkVersion.

if (!project.hasProperty('cdvCompileSdkVersion')) {

cdvCompileSdkVersion = null;

}

Edit4

现在我的android和java路径在下面.

ANDROID_HOME=/Users/admin/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

当我运行cordova build android时,出现以下错误.

com.sun.tools.javac.parser.JavacParser.classOrInterfaceOrEnumDeclaration(JavacParser.java:3226)

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileDebugJavaWithJavac'.

> Compilation failed; see the compiler error output for details.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值