【问题标题】:ionic not generating android-build离子不生成android-build
【发布时间】:2018-02-25 06:28:32
【问题描述】:

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

ionic cordova 准备 android 科尔多瓦准备机器人 运行命令:“C:\Program Files\nodejs\node.exe” C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare\010_add_platfo rm_class.js C:\Users\pini\Desktop\Drivercheckcall

添加到body类:platform-android 运行命令:“C:\Program Files\nodejs\node.exe” C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare\020_remove_sas s_from_platforms.js C:\Users\pini\Desktop\Drivercheckcall

cordova 构建 android --release × 运行命令 - 失败! [ERROR] 运行 cordova build android --release 时出错(退出代码 1):

    Running command: "C:\Program Files\nodejs\node.exe"
    C:\Users\pini\Desktop\Drivercheckcall\hooks\after_prepare\010_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_prepare\020_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.

【问题讨论】:

    标签: ionic-framework android-sdk-tools


    【解决方案1】:

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

    未能应用插件 [class 'com.google.gms.googleservices.GoogleServicesPlugin'] 对于输入字符串:“+” :

    所以一个解决办法是:在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 play 服务在版本中匹配,在我的情况下,在指定版本后,我最终得到了这样的文件:

    # 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+
    

    【讨论】:

    • 我仍然收到相同的错误“在平台/android 中打开 project.properties”#cordova.system.library.2=com.google.android.gms:play-services-location:+cordova。 system.library.2=com.google.android.gms:play-services-maps:+ cordova.gradle.include.1=cordova-plugin-mauron85-background-geolocation/DriverCheckCall-logtofile.gradle #cordova.system.library .3=com.google.android.gms:play-services-location:+ cordova.system.library.3=com.google.android.gms:play-services-location:+ 我已经完成了这个更改
    • 我看到很多“+”,你应该喜欢我在上面的回复中向你展示的内容,将“+”替换为实际版本尝试与播放服务相同
    • 我将 com.google.gms:google-services:+ 更改为 com.google.gms:google-services:3.1.2。只需将所有内容放到最新的发布版本中即可使用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-30
    • 2016-05-19
    • 1970-01-01
    • 2023-02-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多