Android Gradle plugin 3.0.1 must not be applied to project
If you are creating just an app, remove apply plugin: 'com.android.library'
.
If you are creating a library replace apply plugin: 'com.android.application'
with apply plugin: 'com.android.library'
and remove applicationId
.
Refer this - Creating Android Libraries