更新gradle - ./gradlew:找不到这样的文件

问题描述 投票:-1回答:1

我正在使用Angular和Firebase构建一个离子应用程序。

当我尝试通过执行cordova build android来构建它时,我收到一条错误消息:

* What went wrong:
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[11.0.1,11.0.1], [15.0.1,15.0.1]], but resolves to 15.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

所以我想我的build.gradle中的某些东西已经过时了,这种依赖性就像这样(在platforms\android\app\build.gradle中:

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.gms:google-services:+"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
compile "com.google.firebase:firebase-perf:+"
compile "com.google.android.gms:play-services-analytics:11.0.1"
compile "com.google.android.gms:play-services-location:15.+"
// SUB-PROJECT DEPENDENCIES END
}

错误中的最后一句话说我应该运行./gradlew :app:dependencies,但是当我在我的主项目目录中执行此操作时,我得到了erorr:

bash: ./gradlew: No such file or directory,然而,做gradle -v返回版本号Gradle 4.9 ...

我不明白发生了什么......有什么想法吗?谢谢!

android cordova ionic-framework gradle ionic2
1个回答
0
投票

你必须将compile "com.google.android.gms:play-services-analytics:11.0.1"更新为implementation "com.google.android.gms:play-services-analytics:15.0.1。这正是造成版本冲突的原因,因为play-services-location要求15.0.1。同时还有16.0.1,这需要更新其他版本号,类似。 ......与此同时,还有Firebase Analytics

在Linux上,偶尔需要chmod +x ./gradlew,使其可执行...这个文件应该驻留在项目的目录中; gradle -v可能会返回全局版本号,这可能与包装器实际使用的版本不同。

© www.soinside.com 2019 - 2024. All rights reserved.