Apply Plugin not working in gradle with NDK

I am trying to add realm to my app. Their documentation states that I need to add class path dependency to the project level build.gradle file. And Apply the realm-android plugin to the top application application level build.gradle file. (https://realm.io/docs/java/latest/)