1

在我的 ionic 项目中,执行起来没有问题:

ionic cordova platform add android

但在那之后我尝试运行:

ionic cordova build android --prod --release

我收到以下错误:

Total time: 2.535 secs
Error: 

/Users/USER/Desktop/APP/APP/platforms/android/gradlew: Command failed with exit code 1 Error output:
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)
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)
...
FAILURE: Build failed with an exception.

* Where:
Script 

'/Users/USER/Desktop/APP/APP/platforms/android/cordova-plugin-intercom/app-intercom.gradle' line: 45

* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin [class 
'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[ERROR] An error occurred while running cordova build android --release (exit code 1).

似乎对讲机正在尝试在 intercom.gradle 添加一个插件:

if (pushType == 'fcm') {
    tasks.copyGoogleServices.execute()
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

并尝试从带有 + 的版本中添加一些属性。

下面我添加我的 package.json 来帮助你,我读到 google-services 版本存在一些问题,我设置了我所有的 google-services:3.0.0 版本。但还是崩溃。

"dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@angular/router": "4.3.6",
    "@ionic-native/camera-preview": "4.2.1",
    "@ionic-native/core": "3.8.0",
    "@ionic-native/diagnostic": "^4.4.2",
    "@ionic-native/facebook": "4.2.1",
    "@ionic-native/firebase": "3.14.0",
    "@ionic-native/geolocation": "4.2.1",
    "@ionic-native/in-app-browser": "3.14.0",
    "@ionic-native/intercom": "^4.4.2",
    "@ionic-native/keyboard": "3.14.0",
    "@ionic-native/media": "3.14.0",
    "@ionic-native/native-geocoder": "4.2.1",
    "@ionic-native/network": "4.2.1",
    "@ionic-native/social-sharing": "3.8.0",
    "@ionic-native/splash-screen": "3.8.0",
    "@ionic-native/status-bar": "3.8.0",
    "@ionic/storage": "2.0.1",
    "@ngx-translate/core": "6.0.1",
    "@ngx-translate/http-loader": "0.0.3",
    "angular2-logger": "0.5.1",
    "angularfire2": "4.0.0-rc.0",
    "angulartics2": "2.3.0",
    "com.jareddickson.cordova.tag-manager": "1.0.1",
    "cordova-android": "6.3.0",
    "cordova-custom-config": "^4.0.2",
    "cordova-ios": "^4.4.0",
    "cordova-multidex": "git+https://github.com/jwall149/cordova-multidex.git",
    "cordova-plugin-add-swift-support": "1.7.0",
    "cordova-plugin-appsflyer-sdk": "4.2.23",
    "cordova-plugin-camera-preview": "git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-crosswalk-webview": "2.3.0",
    "cordova-plugin-device": "1.1.6",
    "cordova-plugin-facebook4": "1.9.1",
    "cordova-plugin-file": "4.3.3",
    "cordova-plugin-geolocation": "2.4.3",
    "cordova-plugin-googleplayservices": "~19.0.3",
    "cordova-plugin-inappbrowser": "1.7.1",
    "cordova-plugin-intercom": "^4.1.2",
    "cordova-plugin-media": "3.0.1",
    "cordova-plugin-nativegeocoder": "1.0.2",
    "cordova-plugin-network-information": "1.3.3",
    "cordova-plugin-splashscreen": "4.0.3",
    "cordova-plugin-statusbar": "2.2.1",
    "cordova-plugin-tag-manager": "^1.0.1",
    "cordova-plugin-whitelist": "1.3.1",
    "cordova-plugin-x-socialsharing": "5.2.0",
    "cordova.plugins.diagnostic": "^3.7.2",
    "enhanced-resolve": "3.4.1",
    "es6-promise-plugin": "4.1.0",
    "firebase": "3.9.0",
    "gl-ionic2-env-configuration": "0.0.18",
    "ionic-angular": "3.1.1",
    "ionic-audio": "3.2.0",
    "ionic-plugin-keyboard": "2.2.1",
    "ionicons": "3.0.0",
    "lodash": "4.17.4",
    "me.tonny.cordova.plugins.multidex":      "https://github.com/jwall149/cordova-multidex",
    "ngx-restangular": "1.0.11",
    "npm": "^5.5.1",
    "properties-parser": "^0.2.3",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.8.17"
  },
  "devDependencies": {
    "@biesbjerg/ngx-translate-extract": "2.3.1",
    "@ionic/app-scripts": "1.3.6",
    "typescript": "2.2.2"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-device",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-crosswalk-webview",
    "cordova-plugin-x-socialsharing",
    "cordova-plugin-media"
  ],
4

0 回答 0