Gradle - 错误找不到参数的方法 implementation() \[com.android.support:appcompat-v7:26.0.0\]

新手上路,请多包涵

我正在尝试在 android studio 中打开现有的 android 项目,并且它 gradle 无法在没有错误的情况下构建应用程序

错误android studio不断抛出

Error:(74, 1) A problem occurred evaluating project ':app'.
> Could not find method implementation() for arguments
[com.android.support:appcompat-v7:26.0.0] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

我在 build.gradle 中的代码 这可以帮助理解我的问题 我的依赖项

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')

// google & support
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'

// utils
implementation 'com.github.bumptech.glide:glide:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
implementation 'com.koushikdutta.ion:ion:2.1.7'
implementation 'com.github.Commit451:bypasses:1.0.4'
implementation 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
implementation 'com.drewnoakes:metadata-extractor:2.9.1'
implementation "com.orhanobut:hawk:2.0.1"

}

请帮助解决问题

原文由 cole 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1k
2 个回答

compile 替换为 implementation

compile 最近被 弃用 并被 implementationapi 取代

原文由 Saurabh Thorat 发布,翻译遵循 CC BY-SA 4.0 许可协议

确保在 android/app/build.gradle 中添加这些依赖项,而不是 android/build.gradle

原文由 Sunil Kumar 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题