ionic 不生成 android-build

ionic not generating android-build

[WARN] 不为项目类型执行 Ionic 构建:ionic1。

ionic cordova prepare android cordova prepare android Running command: "C:\Program Files\nodejs\node.exe" C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare0_add_platfo rm_class.js C:\Users\pini\Desktop\Drivercheckcall

添加到正文class:平台-android 运行 命令:"C:\Program Files\nodejs\node.exe" C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare0_remove_sas s_from_platforms.js C:\Users\pini\Desktop\Drivercheckcall

cordova build android --release × Running command - failed! [ERROR] An error occurred while running cordova build android --release (exit code 1):

    Running command: "C:\Program Files\nodejs\node.exe"
    C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare0_add_platform_class.js
    C:\Users\pini\Desktop\Drivercheckcall
    add to body class: platform-android
    Running command: "C:\Program Files\nodejs\node.exe"
    C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare0_remove_sass_from_platforms.js
    C:\Users\pini\Desktop\Drivercheckcall
    ANDROID_HOME=C:\Users\pini\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
    Subproject Path: CordovaLib
    Starting a Gradle Daemon (subsequent builds will be faster)
    The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use
    Task.doLast(Action) instead.
            at build_yewq1sjt6kzw92w3qmfn4wt0.run(C:\Users\pini\Desktop\Drivercheckcall\platforms\android\build.gradle:1

39)

    FAILURE: Build failed with an exception.

    * Where:
    Script
    'C:\Users\pini\Desktop\Drivercheckcall\platforms\android\phonegap-plugin-push\DriverCheckCall-push.gradle' line:
    38

    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > 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.

    BUILD FAILED

    Total time: 23.062 secs
    Error: cmd: Command failed with exit code 1 Error output:
    FAILURE: Build failed with an exception.

    * Where:
    Script
    'C:\Users\pini\Desktop\Drivercheckcall\platforms\android\phonegap-plugin-push\DriverCheckCall-push.gradle' line:
    38

    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > 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.

我之前在推送插件或地图插件或 google 插件中看到过这个问题,它与 cordova 插件及其依赖项有关,在你的情况下,这一行很有帮助。

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin'] For input string: "+" :

所以一个解决方法是:在 platforms/android 中打开 project.properties,你会得到类似这样的东西

cordova.system.library.2=com.google.android.gms:play-services-maps:+
cordova.system.library.3=com.google.android.gms:play-services-location:+

尝试让 google 播放服务在版本上匹配,在我的例子中,在指定版本后我得到了这样的文件:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.google.android.gms:play-services-maps:11.0.1
cordova.system.library.3=com.google.android.gms:play-services-location:11.0.1
cordova.system.library.4=com.google.android.gms:play-services-location:11.0.1
cordova.system.library.5=com.android.support:support-v13:25.1.0
cordova.system.library.6=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.7=com.google.firebase:firebase-messaging:11.0.1
cordova.gradle.include.1=phonegap-plugin-push/custodian-push.gradle
cordova.system.library.8=com.squareup.okhttp3:okhttp:3+