The following shows up when I'm tryig to work:
Could not find method android() for arguments [build_9cxkoz5xxe5p8ydg2a1ig2k7b$_run_closure1@7b0f017] on root project 'dangerous-forest-game-android' of type org.gradle.api.Project.
I have been looking for a solution to my problem, but I found my syntax is too different. Here is the code of my android()
function :
android {
buildToolsVersion "19.1.0"
compileSdkVersion 20
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
You have to use the android
DSL only in your app/build.gradle
file and not in the root/build.gradle
file.
Also you have to apply the android plugin in the app/build.gradle
file before using it. Check the official doc .
/**
* The first line in the build configuration applies the Android plugin for
* Gradle to this build and makes the android block available to specify
* Android-specific build options.
*/
apply plugin: 'com.android.application'
/**
* The android block is where you configure all your Android-specific
* build options.
*/
android {
//.....
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.