Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: DSL method not found: minSdkVersion / targetSdkVersion / compileSdkVersion / buildToolsVersion

As it took me some time to find the solution for this error, I post my problem and solution here in the hope that I find it next time faster:

Error:(39, 0) Gradle DSL method not found: 'minSdkVersion()'

What I tried to do:

  • I followed the Android Test Blueprint's sample to define the library versions in the top level / rootProject'S build.gradle file:

    ext { minSdkVersion 16 }

  • And wanted to use it in the app's/module's build.gradle file:

    minSdkVersion rootProject.ext.minSdkVersion

like image 857
hb0 Avatar asked Sep 28 '26 00:09

hb0


1 Answers

After half an hour or so I notices that this was a simple typo -.-

Solution

Add the "=" sign when you define a variable, else, Gradle thinks you call an Android method which it does not yet know in the top level build file:

ext { minSdkVersion = 16 }
like image 124
hb0 Avatar answered Sep 29 '26 13:09

hb0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!