问题描述
限时送ChatGPT账号..我将一个项目导入到 Android Studio,但该项目没有被构建.我得到的错误信息是:
错误:(20, 0) 找不到参数的方法 compile() [文件集合]在类型对象上org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.<a href="openFile:C:\Users\xxx\AndroidStudioProjects\WSAppAndroid\build.gradle">打开文件</a>
如下面的图 1 所示,在 gradle.build(项目)中,我在依赖项部分有这些库.
我用谷歌搜索了如何解决这个问题,我发现的帖子中有
build.gradle(项目):
//顶级构建文件,您可以在其中添加常见的配置选项所有子项目/模块.构建脚本{存储库{jcenter()MavenCentral()}依赖{类路径 'com.android.tools.build:gradle:2.3.0'类路径 'com.neenbedankt.gradle.plugins:android-apt:1.7'//1.8?}}所有项目{存储库{jcenter()MavenCentral()}}依赖{编译文件('gradle/wrapper/gradle-wrapper.jar')编译文件('app/libs/android-viewbadger.jar')编译文件('app/libs/iDappsImagesLib_v0.2.jar')编译文件('app/libs/iDappsToolsLib_v0.1.jar')编译'com.android.support:support-v4:25.2.0'}
compile-on-org-gradle-api-internal-artifacts-dsl-depen/33991915#33991915
解决方案compile 已在较新版本的 gradle 中替换为 implementation,将 build.gradle 文件中的 compile 替换为 implementation 并将 compile group 替换为 implmenetation group.
I imported a project into Android Studio, but the project is not getting built. the error message I get is:
Error:(20, 0) Could not find method compile() for arguments [file collection]
on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
<a href="openFile:C:\Users\xxx\AndroidStudioProjects\WSAppAndroid
\build.gradle">Open File</a>
As shown in image-1 posted below, in gradle.build (project) I have these libraries in the dependencies section.
I googled how to solve this issue and among the posts I found was this one which tackles the same problem. But the accepted answer does not solve the problem i have.
As an attempt to solve this issue, can I use compile
instead of compile files
in build.gradle? how it can be done?
my question is
image-1
build.gradle (project):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' // 1.8?
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
dependencies {
compile files('gradle/wrapper/gradle-wrapper.jar')
compile files('app/libs/android-viewbadger.jar')
compile files('app/libs/iDappsImagesLib_v0.2.jar')
compile files('app/libs/iDappsToolsLib_v0.1.jar')
compile 'com.android.support:support-v4:25.2.0'
}
compile-on-org-gradle-api-internal-artifacts-dsl-depen/33991915#33991915
解决方案compile has been replaced by implementation in newer version of gradle, replace compile with implementation and compile group with implmenetation group in your build.gradle file.
这篇关于如何解决找不到参数的方法 compile() [文件集合]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论