When I attempt to use Supabase flutter in an empty flutter project this happens:
Failed to notify project evaluation listener. Cannot invoke method substring() on null object compileSdkVersion is not specified. Please add it to build.gradle
This nightmare of a build error seemingly appeared around the time I upgraded to Flutter 3.19, but I'm not sure. Tried to fix to no avail.
app/build.gradle looks like so:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.example.exp"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {}
Okay false alarm. Apparently had nothing to do with supabase. First I performed flutter pub cache repair which revealed a few other issues, first adding a missing line to my gradle defualt configs "manifestPlaceholders += [appAuthRedirectScheme: "com.example.ex"]", then later updating my kotlin version, eventually requiring me to add multidex support to my project. Strangely, it all works now. These issues set upon me quite quickly and I was confused how I got here. The more you know! Hope this helps someone else.