Reputation: 384
I can't connect my app to Google Firebase and I need to see somethings in that build gradle file. When I open the app level build gradle, I get errors, I am trying to connect my app to Google Firebase but when I open my app normally, I see no errors at all and everything is going just fine and I can still run my app on the Android Emulator, but when I go ahead and open the file, errors start to pop up and I am unable to run my app, here is my app level build gradle for Android:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "co.appbrewery.flash_chat"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
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
}
}
}
flut
ter {
source '../..'
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.0'
}
I am unable to understand the problem. Please help.
Upvotes: 1
Views: 1327
Reputation: 59
Goto : Tools -> Flutter -> Open Flutter Module in Android Studio -> Make changes in build gradle
Upvotes: 0
Reputation: 83
You can't edit the gradle files in the flutter project. You have to click on Tools --> Flutter --> Open Android Module in Android Studio. Then you can edit the graddle, run the app and come back to the flutter project with no errors.
Upvotes: 1