我正在为Android设备构建Ionic应用程序。我的 gradle 版本是 3.3。我是这个安卓建筑的第一次计时器。我收到以下错误:
Build file 'E:FarmAppsmartFarmplatformsandroidbuild.gradle' line: 33
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'classpath' for object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
我的build.gradle文件部分如下
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',
classpath 'com.google.gms:google-services:3.1.0'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
mavenCentral();
jcenter()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
}
删除类路径末尾的逗号。这对我有用。
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.0'
}
尝试从ionic
中删除android
平台,然后使用以下命令重新添加
$ ionic platform remove android
$ ionic platform add android