I had a flutter app working fine, then I thought I'd upgrade all my plugins to androidX, and everything work fine before I decided to add firebase_messaging, I've tried version 4,5, none worked, keep throwing that error as if i'm on the wrong version. And I also tried flutter packages pub cache repair
no luck. there's many issues related on github, however they all got closed with people still complaining the fix is not working.
here's my gradle looks like
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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '3'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0.1'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.sggo.uni"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// ndk {
// abiFilters 'x86', 'armeabi-v7a'
// }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.firebase') {
details.useVersion "15.+"
}
}
}
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
import com.google.firebase.iid.InstanceIdResult; ^ symbol: class InstanceIdResult location: package com.google.firebase.iid /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:106: error: cannot find symbol new OnCompleteListener() { ^ symbol: class InstanceIdResult location: class FirebaseMessagingPlugin /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:108: error: cannot find symbol public void onComplete(@NonNull Task task) { ^ symbol: class InstanceIdResult /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:104: error: cannot find symbol .getInstanceId() ^ symbol: method getInstanceId() location: class FirebaseInstanceId /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:133: error: cannot find symbol new OnCompleteListener() { ^ symbol: class InstanceIdResult location: class FirebaseMessagingPlugin /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:135: error: cannot find symbol public void onComplete(@NonNull Task task) { ^ symbol: class InstanceIdResult /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:131: error: cannot find symbol .getInstanceId() ^ symbol: method getInstanceId() location: class FirebaseInstanceId /Users/test/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-5.0.0/android/src/main/java/io/flutter/plugins/firebasemessaging/FlutterFirebaseMessagingService.java:39: error: method does not override or implement a method from a supertype @Override