firebase / flutterfire

šŸ”„ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.72k stars 3.97k forks source link

šŸ› firebase_messaging - cannot find symbol #12123

Closed crobertson247 closed 10 months ago

crobertson247 commented 10 months ago

I have no clue how i got here, nor why its happening but I tried to build my flutter app today and i got the following error message:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.14.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:389: error: cannot find symbol
            .checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
                                                    ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebasePermissionManager.java:63: error: cannot find symbol
    permissions.add(Manifest.permission.POST_NOTIFICATIONS);
                                       ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\JobIntentService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_messaging:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 41s
Running Gradle task 'assembleDebug'...                             42,2s
Exception: Gradle task assembleDebug failed with exit code 1

This is the section of code where i use the firebase messaging:

import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:presentpal/main.dart';

class FirebaseApi {
  final _firebaseMessaging = FirebaseMessaging.instance;
  static const String basicChannelKey = 'basic_channel';

  Future<void> initNotifications() async {
    await _firebaseMessaging.requestPermission();
    final fCMToken = await _firebaseMessaging.getToken();
    //usually would send to server ???
    print('FCM Token: $fCMToken');

    initPushNotifications();
  }

  Future<void> handleMessage(RemoteMessage? message) async {
    if (message == null) return;
    navigatorKey.currentState?.pushNamed('/giftChoose'
        //, arguments: message
        );
  }

  Future initPushNotifications() async {
    await _firebaseMessaging.setForegroundNotificationPresentationOptions(
        alert: true, badge: true, sound: true);

    _firebaseMessaging.getInitialMessage().then(handleMessage);
    FirebaseMessaging.onMessageOpenedApp.listen(handleMessage);
    FirebaseMessaging.onBackgroundMessage(handleBackgroundMessage);
    FirebaseMessaging.onMessage.listen(handleForegroundMessage);
  }

  Future<void> handleForegroundMessage(RemoteMessage message) async {
    final notification = message.notification;
    if (notification == null) return;
    int uniqueId = DateTime.now().millisecondsSinceEpoch ~/ 1000;
    await AwesomeNotifications().createNotification(
      content: NotificationContent(
        id: uniqueId,
        channelKey: basicChannelKey,
        title: notification.title,
        body: notification.body,
      ),
    );
  }
}

@pragma('vm:entry-point')
Future<void> handleBackgroundMessage(RemoteMessage message) async {
  print("Handling a background message: ${message.messageId}");
}

main.dart:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  MobileAds.instance.initialize();

  //get user data
  await Firebase.initializeApp();

  await FirebaseApi().initNotifications();

im targeting version android SDK 34

root build.gradle': buildscript {
    ext.kotlin_version = '1.8.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
/*
subprojects{
    afterEvaluate {
        android {
            namespace 'com.presentpal.app'
        }
    }
}*/

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

app build.gradle:

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.")
    println("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '4'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    println keystorePropertiesFile
}

android {
    namespace 'com.presentpal.app'
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
    /*
    packagingOptions {
        exclude 'META-INF/LICENSE'
        // ... exclude other problematic files ...
    }
    // Add the following android block with the namespace attribute
    if (project.android.hasProperty("namespace")) {
        namespace("com.presentpal.app")
    }*/

    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.presentpal.app"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 21
        targetSdk 34
        versionCode 15 //change the version code here
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    //namespace 'com.presentpal.app'
}

flutter {
    source '../..'
}

apply plugin: 'com.google.gms.google-services'
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    //apply plugin: 'com.google.gms.google-services'
    implementation(platform("com.google.firebase:firebase-bom:32.2.2"))
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.android.gms:play-services-ads:22.3.0'
}
danagbemava-nc commented 10 months ago

Hi @crobertson247, did you recently start running into this issue? Did you change any configuration in your project?

Also, you don't need to add the native firebase dependencies in your build.gradle. It will be added by the plugins. Can you try removing them to see if your project builds?

implementation(platform("com.google.firebase:firebase-bom:32.2.2"))
implementation 'com.google.firebase:firebase-analytics'
crobertson247 commented 10 months ago

Hi, yes I went on holiday for 2 weeks and came back to the issue off my first run, it was working after i left. The only thing that changed was I had to erase my computer due to a driver issue and reinstall my development environment. I thought the issue had to do with that so I reinstalled everything but i still encounter the same issue. Install flutter into src, add path to its bin in env variables, installed jdk 17 from oracle and added JAVA_HOME path, installed vs code and android studio and the cli tools for android studio. Even tried to update my gradle version from 7.5 to 7.6.1 and retrieve an older version that worked from my git repository and still not working.

After removing those two lines i get the following still:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.14.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.        
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:389: error: cannot find symbol
            .checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
                                                    ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebasePermissionManager.java:63: error: cannot find symbol
    permissions.add(Manifest.permission.POST_NOTIFICATIONS);
                                       ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\JobIntentService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java uses unchecked or unsafe operations.   
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_messaging:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 12s
Running Gradle task 'assembleDebug'...                             73,4s
Exception: Gradle task assembleDebug failed with exit code 1
crobertson247 commented 10 months ago

Update: I tried removing the firebase messaging plugin to see if it would work without it and get the following:

Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.14.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.        
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\google_mobile_ads-3.1.0\android\src\main\java\io\flutter\plugins\googlemobileads\FlutterAdLoader.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:56: error: cannot find symbol
            case Manifest.permission.BODY_SENSORS_BACKGROUND:
                                    ^
  symbol:   variable BODY_SENSORS_BACKGROUND
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:85: error: cannot find symbol
            case Manifest.permission.POST_NOTIFICATIONS:
                                    ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:87: error: cannot find symbol
            case Manifest.permission.NEARBY_WIFI_DEVICES:
                                    ^
  symbol:   variable NEARBY_WIFI_DEVICES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:89: error: cannot find symbol
            case Manifest.permission.READ_MEDIA_IMAGES:
                                    ^
  symbol:   variable READ_MEDIA_IMAGES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:91: error: cannot find symbol
            case Manifest.permission.READ_MEDIA_VIDEO:
                                    ^
  symbol:   variable READ_MEDIA_VIDEO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:93: error: cannot find symbol
            case Manifest.permission.READ_MEDIA_AUDIO:
                                    ^
  symbol:   variable READ_MEDIA_AUDIO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:195: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:196: error: cannot find symbol
                    if (hasPermissionInManifest(context, permissionNames, Manifest.permission.BODY_SENSORS_BACKGROUND)) {
                                                                                             ^
  symbol:   variable BODY_SENSORS_BACKGROUND
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:197: error: cannot find symbol
                        permissionNames.add(Manifest.permission.BODY_SENSORS_BACKGROUND);
                                                               ^
  symbol:   variable BODY_SENSORS_BACKGROUND
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:323: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.POST_NOTIFICATIONS))
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:323: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.POST_NOTIFICATIONS))
                                                                                                     ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:324: error: cannot find symbol
                    permissionNames.add(Manifest.permission.POST_NOTIFICATIONS);
                                                           ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:329: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.NEARBY_WIFI_DEVICES))
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:329: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.NEARBY_WIFI_DEVICES))
                                                                                                     ^
  symbol:   variable NEARBY_WIFI_DEVICES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:330: error: cannot find symbol
                    permissionNames.add(Manifest.permission.NEARBY_WIFI_DEVICES);
                                                           ^
  symbol:   variable NEARBY_WIFI_DEVICES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:335: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_IMAGES))
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:335: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_IMAGES))
                                                                                                     ^
  symbol:   variable READ_MEDIA_IMAGES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:336: error: cannot find symbol
                    permissionNames.add(Manifest.permission.READ_MEDIA_IMAGES);
                                                           ^
  symbol:   variable READ_MEDIA_IMAGES
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:341: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_VIDEO))
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:341: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_VIDEO))
                                                                                                     ^
  symbol:   variable READ_MEDIA_VIDEO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:342: error: cannot find symbol
                    permissionNames.add(Manifest.permission.READ_MEDIA_VIDEO);
                                                           ^
  symbol:   variable READ_MEDIA_VIDEO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:347: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_AUDIO))
                                                                ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:347: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_AUDIO))
                                                                                                     ^
  symbol:   variable READ_MEDIA_AUDIO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:348: error: cannot find symbol
                    permissionNames.add(Manifest.permission.READ_MEDIA_AUDIO);
                                                           ^
  symbol:   variable READ_MEDIA_AUDIO
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:570: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                                                        ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:571: error: cannot find symbol
            return pm.getPackageInfo(context.getPackageName(), PackageManager.PackageInfoFlags.of(PackageManager.GET_PERMISSIONS));
                                                                             ^
  symbol:   variable PackageInfoFlags
  location: class PackageManager
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:612: error: cannot find symbol
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
                                                       ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:621: error: cannot find symbol
        final int status = context.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS);
                                                                          ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:625: error: cannot find symbol
        return PermissionUtils.determineDeniedVariant(activity, Manifest.permission.POST_NOTIFICATIONS);       
                                                                                   ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\ServiceManager.java:172: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                                                        ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.1\android\src\main\java\com\baseflow\permissionhandler\ServiceManager.java:173: error: cannot find symbol
            return pm.queryIntentActivities(callIntent, PackageManager.ResolveInfoFlags.of(0));
                                                                      ^
  symbol:   variable ResolveInfoFlags
  location: class PackageManager
31 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':permission_handler_android:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
Running Gradle task 'assembleRelease'...                           19,1s
Exception: Gradle task assembleRelease failed with exit code 1
#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:491:9)
<asynchronous suspension>
#2      AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:220:5)
<asynchronous suspension>
#3      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:578:7)
<asynchronous suspension>
#4      FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:533:33)
<asynchronous suspension>
#5      ColdRunner.run (package:flutter_tools/src/run_cold.dart:57:28)
<asynchronous suspension>
#6      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:745:27)
<asynchronous suspension>
#7      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350:27) 
<asynchronous suspension>
#8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#10     FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:348:9)
<asynchronous suspension>
#11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#12     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5)   
<asynchronous suspension>
#13     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112:9)
<asynchronous suspension>
#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#15     main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>

How can i fix this?

danagbemava-nc commented 10 months ago

Hi @crobertson247, can you try clearing your pub cache to and re-running flutter pub get in your project directory to see if you still get this issue? It seems like there might be an issue with your local pub cache

danagbemava-nc commented 10 months ago

Hi @crobertson247, can you try clearing your pub cache to and re-running flutter pub get in your project directory to see if you still get this issue? It seems like there might be an issue with your local pub cache

crobertson247 commented 10 months ago

i still get the same error:

flutter clean pub cache
Deleting build...                                                1 906ms
Deleting .dart_tool...                                              20ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting ephemeral...                                                3ms
Deleting ephemeral...                                                1ms
Deleting ephemeral...                                                3ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms
PS C:\Users\cianr\OneDrive\Business\PresentPal\App\presentpal> flutter pub get
"ar": 4 untranslated message(s).
"bn": 4 untranslated message(s).
"de": 4 untranslated message(s).
"es": 4 untranslated message(s).
"fr": 4 untranslated message(s).
"hi": 4 untranslated message(s).
"it": 4 untranslated message(s).
"ko": 4 untranslated message(s).
"pt": 4 untranslated message(s).
"ru": 4 untranslated message(s).
"zh": 4 untranslated message(s).
"zh_HK": 4 untranslated message(s).
To see a detailed report, use the untranslated-messages-file
option in the l10n.yaml file:
untranslated-messages-file: desiredFileName.txt
<other option>: <other selection>

This will generate a JSON format file containing all messages that
need to be translated.
Resolving dependencies... (1.6s)
  awesome_notifications 0.8.2 (0.9.0 available)
  google_mobile_ads 3.1.0 (4.0.0 available)
  google_sign_in_platform_interface 2.4.4 (2.4.5 available)
  intl 0.18.1 (0.19.0 available)
  js 0.6.7 (0.7.0 available)
  matcher 0.12.16 (0.12.16+1 available)
  material_color_utilities 0.5.0 (0.8.0 available)
  meta 1.10.0 (1.11.0 available)
  path 1.8.3 (1.9.0 available)
  path_provider_platform_interface 2.1.1 (2.1.2 available)
  shared_preferences_platform_interface 2.3.1 (2.3.2 available)
  syncfusion_flutter_calendar 23.2.7 (24.1.45 available)
  syncfusion_flutter_core 23.2.7 (24.1.45 available)
  syncfusion_flutter_datepicker 23.2.7 (24.1.45 available)
  test_api 0.6.1 (0.7.0 available)
  url_launcher 6.2.2 (6.2.3 available)
  url_launcher_android 6.2.1 (6.2.2 available)
  url_launcher_ios 6.2.2 (6.2.3 available)
  url_launcher_platform_interface 2.3.0 (2.3.1 available)
  vector_graphics 1.1.9+1 (1.1.9+2 available)
  vector_graphics_codec 1.1.9+1 (1.1.9+2 available)
  vector_graphics_compiler 1.1.9+1 (1.1.9+2 available)
  web 0.3.0 (0.4.0 available)
  webview_flutter 4.4.3 (4.4.4 available)
  webview_flutter_platform_interface 2.9.0 (2.9.1 available)
Got dependencies!
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
PS C:\Users\cianr\OneDrive\Business\PresentPal\App\presentpal> adb connect 192.168.1.104:5555             
connected to 192.168.1.104:5555
PS C:\Users\cianr\OneDrive\Business\PresentPal\App\presentpal> flutter run
"ar": 4 untranslated message(s).
"bn": 4 untranslated message(s).
"de": 4 untranslated message(s).
"es": 4 untranslated message(s).
"fr": 4 untranslated message(s).
"hi": 4 untranslated message(s).
"it": 4 untranslated message(s).
"ko": 4 untranslated message(s).
"pt": 4 untranslated message(s).
"ru": 4 untranslated message(s).
"zh": 4 untranslated message(s).
"zh_HK": 4 untranslated message(s).
To see a detailed report, use the untranslated-messages-file
option in the l10n.yaml file:
untranslated-messages-file: desiredFileName.txt
<other option>: <other selection>

This will generate a JSON format file containing all messages that
need to be translated.
Launching lib\main.dart on SM G965F in debug mode...
Building with Flutter multidex support enabled.
C:\Users\cianr\OneDrive\Business\PresentPal\App\presentpal\android\key.properties
"ar": 4 untranslated message(s).
"bn": 4 untranslated message(s).
"de": 4 untranslated message(s).
"es": 4 untranslated message(s).
"fr": 4 untranslated message(s).
"hi": 4 untranslated message(s).
"it": 4 untranslated message(s).
"ko": 4 untranslated message(s).
"pt": 4 untranslated message(s).
"ru": 4 untranslated message(s).
"zh": 4 untranslated message(s).
"zh_HK": 4 untranslated message(s).
To see a detailed report, use the untranslated-messages-file
option in the l10n.yaml file:
untranslated-messages-file: desiredFileName.txt
<other option>: <other selection>

This will generate a JSON format file containing all messages that
need to be translated.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.14.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:389: error: cannot find symbol     
            .checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
                                                    ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebasePermissionManager.java:63: error: cannot find symbol    
    permissions.add(Manifest.permission.POST_NOTIFICATIONS);
                                       ^
  symbol:   variable POST_NOTIFICATIONS
  location: class permission
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\JobIntentService.java uses or overrides a deprecated API.        
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\cianr\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_messaging-14.7.10\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_messaging:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 55s
Running Gradle task 'assembleDebug'...                             56,0s
Exception: Gradle task assembleDebug failed with exit code 1
danagbemava-nc commented 10 months ago

Hi @crobertson247, the command to clean the cache is flutter pub cache clean not flutter clean pub cache.

Can you try running that and re-running flutter pub get and running the app again to see if this persists?

crobertson247 commented 10 months ago

HI, @danagbemava-nc, I ran it and still get the same error, also tried the cache repair and no luck.

darshankawar commented 10 months ago

@crobertson247 If you downgrade to previous plugin version (let's say 14.7.4), can you check if you still get same error ? Also, please try to replicate it only using flutterfire plugins, ie without third party ones such as awesome_notifications that you are using.

crobertson247 commented 10 months ago

@darshankawar I reset windows and now I'm getting this error:

Running Gradle task 'assembleDebug'...                            460.6s
āˆš  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...          924ms
E/FirebaseInstanceId( 7840): Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won't retry the operation.
I/WebViewFactory( 7840): Loading com.google.android.webview version 113.0.5672.136 (code 567263637)
W/ziparchive( 7840): Unable to open '/data/app/~~3XmKbb4-rt1-iswF_QxdPw==/com.google.android.trichromelibrary_567263637-HvszzSUk26B6oMKiwenSZQ==/TrichromeLibrary.dm': No such file or directory
W/ziparchive( 7840): Unable to open '/data/app/~~3XmKbb4-rt1-iswF_QxdPw==/com.google.android.trichromelibrary_567263637-HvszzSUk26B6oMKiwenSZQ==/TrichromeLibrary.dm': No such file or directory
W/.presentpal.app( 7840): Entry not found
D/nativeloader( 7840): Configuring clns-7 for other apk /data/app/~~3XmKbb4-rt1-iswF_QxdPw==/com.google.android.trichromelibrary_567263637-HvszzSUk26B6oMKiwenSZQ==/TrichromeLibrary.apk. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~mKpfOaWN0IKspfDCuh_RKA==/com.google.android.webview-Opo9CIVvkG_4bUfdHdF_4A==/lib/x86_64:/data/app/~~mKpfOaWN0IKspfDCuh_RKA==/com.google.android.webview-Opo9CIVvkG_4bUfdHdF_4A==/WebViewGoogle.apk!/lib/x86_64:/data/app/~~3XmKbb4-rt1-iswF_QxdPw==/com.google.android.trichromelibrary_567263637-HvszzSUk26B6oMKiwenSZQ==/TrichromeLibrary.apk!/lib/x86_64, permitted_path=/data:/mnt/expand
D/nativeloader( 7840): Configuring clns-8 for other apk /data/app/~~mKpfOaWN0IKspfDCuh_RKA==/com.google.android.webview-Opo9CIVvkG_4bUfdHdF_4A==/WebViewGoogle.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~mKpfOaWN0IKspfDCuh_RKA==/com.google.android.webview-Opo9CIVvkG_4bUfdHdF_4A==/lib/x86_64:/data/app/~~mKpfOaWN0IKspfDCuh_RKA==/com.google.android.webview-Opo9CIVvkG_4bUfdHdF_4A==/WebViewGoogle.apk!/lib/x86_64:/data/app/~~3XmKbb4-rt1-iswF_QxdPw==/com.google.android.trichromelibrary_567263637-HvszzSUk26B6oMKiwenSZQ==/TrichromeLibrary.apk!/lib/x86_64, permitted_path=/data:/mnt/expand
W/.presentpal.app( 7840): Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed)
W/.presentpal.app( 7840): Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed)
W/.presentpal.app( 7840): Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed)
W/.presentpal.app( 7840): Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed)
W/.presentpal.app( 7840): Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed)
I/cr_WVCFactoryProvider( 7840): Loaded version=113.0.5672.136 minSdkVersion=29 isBundle=false multiprocess=true packageId=2
I/cr_LibraryLoader( 7840): Successfully loaded native library
I/cr_CachingUmaRecorder( 7840): Flushed 8 samples from 8 histograms.
I/cr_VariationsUtils( 7840): Failed reading seed file "/data/user/0/com.presentpal.app/app_webview/variations_seed_new"
I/cr_VariationsUtils( 7840): Failed reading seed file "/data/user/0/com.presentpal.app/app_webview/variations_seed"
I/cr_VariationsUtils( 7840): Requesting new seed from IVariationsSeedServer
Syncing files to device sdk gphone64 x86 64...                     245ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on sdk gphone64 x86 64 is available at:
http://127.0.0.1:50092/46TdCSygVaI=/
The Flutter DevTools debugger and profiler on sdk gphone64 x86 64 is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:50092/46TdCSygVaI=/
D/AutofillManager( 7840): Fill dialog is enabled:false, hints=[password, passwordAuto, creditCardNumber, creditCardSecurityCode, creditCardExpirationDate]
D/CompatibilityChangeReporter( 7840): Compat change id reported: 214741472; UID 10190; state: ENABLED
D/CompatibilityChangeReporter( 7840): Compat change id reported: 171228096; UID 10190; state: ENABLED
W/cr_media( 7840): BLUETOOTH_CONNECT permission is missing.
W/cr_media( 7840): registerBluetoothIntentsIfNeeded: Requires BLUETOOTH permission
I/Choreographer( 7840): Skipped 74 frames!  The application may be doing too much work on its main thread.
D/CompatibilityChangeReporter( 7840): Compat change id reported: 3400644; UID 10190; state: ENABLED
I/Ads     ( 7840): JS: The jsLoaded GMSG has been sent (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html:785)
I/chromium( 7840): [INFO:CONSOLE(785)] "The jsLoaded GMSG has been sent", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (785)
I/FA      ( 7840): Application backgrounded at: timestamp_millis: 1705071802177
D/CompatibilityChangeReporter( 7840): Compat change id reported: 78294732; UID 10190; state: ENABLED
E/FirebaseInstanceId( 7840): Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won't retry the operation.
E/flutter ( 7840): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_messaging/unknown] java.io.IOException: AUTHENTICATION_FAILED
E/flutter ( 7840): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter ( 7840): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
E/flutter ( 7840): <asynchronous suspension>
E/flutter ( 7840): #2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:522:43)
E/flutter ( 7840): <asynchronous suspension>
E/flutter ( 7840): #3      MethodChannelFirebaseMessaging.getToken (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:248:11)
E/flutter ( 7840): <asynchronous suspension>
E/flutter ( 7840): #4      FirebaseApi.initNotifications (package:presentpal/api/firebase_api.dart:11:22)
E/flutter ( 7840): <asynchronous suspension>
E/flutter ( 7840): #5      main (package:presentpal/main.dart:58:3)
E/flutter ( 7840): <asynchronous suspension>
E/flutter ( 7840):
D/ProfileInstaller( 7840): Installing profile for com.presentpal.app
crobertson247 commented 10 months ago

Update: Got it working after the last error message on a real device, looks like the emulator I was trying to use in the last comment was causing the error.