Answer the question
In order to leave comments, you need to log in
How to correctly add the plugins section in the build.gradle file?
Following the Realm documentation for Android, stumbled on this step:
Apply the realm-android plugin near the top of your application level build.gradle file:
apply plugin: 'realm-android'
plugins {
id 'com.android.application'
}
...
apply plugin: 'realm-android'
plugins {
id 'com.android.application'
}
...
An error is thrown:Build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle' line: 3
Could not compile build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle'.
> startup failed:
build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle': 3: only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed
plugins {
id 'com.android.application', 'realm-android'
}
...
An error is thrown:Build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle' line: 2
Could not compile build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle'.
> startup failed:
build file 'C:\Users\Admin\AndroidStudioProjects\RealmNotes\app\build.gradle': 2: argument list must be exactly 1 literal String or String with property replacement
/*
plugins {
id 'com.android.application'
}
*/
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question