1
A
回答
2
您使用了错误build.gradle
文件。
您不能在顶层文件中使用compile
。使用module/build.gradle
。
<PROJECT_ROOT>\app\build.gradle
是针对应用模块的具体。
<PROJECT_ROOT>\build.gradle
是“顶层构建文件”您可以在其中添加对所有子项目/模块通用的配置选项。
此外,您应该将库包含在dependencies
块中,而不是在buildscript
块中。
顶级文件例如:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
在app\build.gradle
您的模块只定义属性:
apply plugin: 'com.android.application'
android {
compileSdkVersion ...
buildToolsVersion ...
}
dependencies {
//..... HERE !
}
相关问题
- 1. 找不到方法compile()参数
- 2. 未找到Gradle DSL方法:compile()
- 3. 未找到Android Gradle方法:'compile()'
- 4. 在Gradle Android Studio中找不到方法compile()
- 5. Gradle Sync失败:找不到方法compile()参数
- 6. 错误:(9,0)找不到方法compile()参数[io.reactivex:rxandroid:1.2.1]
- 7. 引用错误找不到变量$ compile
- 8. Android gradle错误:(69,0)未找到Gradle DSL方法:'compile()'
- 9. 未找到Gradle DSL方法:使用tesseract库时'compile()'
- 10. 未找到gradle dsl方法'compile()'错误:(10,0)
- 11. 未找到Gradle DSL方法:Android Studio 2.0上的'compile()'
- 12. 错误:(62,0)未找到Gradle DSL方法:'compile()'
- 13. Neokree导航抽屉:未找到Gradle DSL方法:'compile()'
- 14. Gradle同步失败:无法找到参数> [目录'库']的方法compile()
- 15. Gradle同步失败:无法找到方法compile()参数[com.android.support:appcompat-v7:25.3.1]
- 16. 找不到方法
- 17. 找不到方法
- 18. 找不到方法
- 19. 找不到“.dealcard”方法和“.shuffle”方法。
- 20. Lambda Expression Compile()方法有什么作用?
- 21. 找不到方法com.google.android.gms.common.GooglePlayServicesUtil
- 22. 找不到方法classpath()
- 23. android - onclick找不到方法
- 24. 找不到的onClick方法
- 25. 找不到方法makeScaleUpAnimation
- 26. 对象找不到方法
- 27. 的JOptionPane找不到方法
- 28. 找不到符号方法
- 29. 找不到方法DragMove
- 30. 找不到方法jacocoTestCoverageVerification()
你看了'NOTE',即位于第14行? – DeKaNszn