我正在尝试做“科尔多瓦构建android'在一个多重项目中。 项目结构如:
android(MainApp)
|-- build.gradle
|-- setting.gradle
|-- gradle.properties
|--LibProject1
|-- build.gradle
|-- setting.gradle
|-- gradle.properties
|--LibProject2
|-- build.gradle
|-- setting.gradle
|-- gradle.properties
|--LibProject2_1
|-- build.gradle
|-- setting.gradle
|-- gradle.properties
' cordova准备android'和&#cord;插件'运行成功,但&#cord; buildova'在很长很奇怪的错误中失败了:
Running command: ******\platforms\android\cordova\build.bat
ANDROID_HOME=*****
JAVA_HOME=*****
Running: ******android\gradlew cdvBuildDebug -b ****platforms\android\build.gradle -Dorg.gradle.daemon=true
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:176)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:444)
at com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy:415)
at com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
FAILURE: Build failed with an exception.
* Where:
Build file '*****platforms\android\LibProject1\build.gradle' line: 49
* What went wrong:
A problem occurred evaluating project ':LibProject1'.
> Project with path ':LibProject2' could not be found in project ':LibProject1'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.142 secs
******platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "******\platforms\android\gradlew cdvBuildDebug -b
******\platforms\android\build.gradle -Dorg.gradle.daemon=true"
Error: ******platforms\android\cordova\build.bat: Command failed with exit code 8
at ChildProcess.whenDone (****AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
似乎它说我的LibProject1 / build.gradle有一些错误但是#gradle build'成功了,我得到了apk正常运行。
最后我发现当&cordova构建android'运行,文件LibProject1 / build.gradle正在自动更改。例如:
dependencies{
compile project(':LibProject1')
}
更改为
dependencies{
debugCompile project(path: ":LibProject1", configuration: "debug")
releaseCompile project(path: ":LibProject1", configuration: "release")
}
我真的很困惑这个问题。 有人能帮帮我吗?并感谢您阅读这么久