Anybody has a clue why after upgrading to AGP 4.1....
# gradle
u
Anybody has a clue why after upgrading to AGP 4.1.0, it cannot see constants from ext?
Parameter specified as non-null is null: method com.android.build.gradle.BaseExtension.compileSdkVersion, parameter version
Copy code
android {
    compileSdkVersion compileSdk
    defaultConfig {
        minSdkVersion minSdk.o2
        targetSdkVersion targetSdk
    ...
Copy code
ext {
    compileSdk = 29
    ...
It's worked before the update
k
Use ext.compileSdk to reference it...bit me too...
This has nothing to do with Gradle FYI
u
Copy code
android {
    compileSdkVersion ext.compileSdk

> Cannot get property 'compileSdk' on extra properties extension as it does not exist

:/
I apply the config.gradle where the ext block lies here in root project gradle file (so its visible from everywhere)
Copy code
buildscript {
    apply from: "config.gradle"
maybe thats not valid anymore?
k
Ohhh... That was it....apply it from outside as well. Forgot...been a while since I did this...
u
outside?
k
Outside buildscript
u
okay turns out I only had to refer to the ext vars as rootProject.ext.foo but only for the things in android block; dependencies works as usual..weird
k
We have code that loops through all our modules and imports the dependencies instead.
That way, you don't need to reference rootProject