gokadzev / capacitor-music-controls-plugin-new

An update to Cordova Music Controls plugin to support Capacitor 3
9 stars 4 forks source link

error: cannot find symbol PendingIntent.FLAG_MUTABLE #7

Closed mtrnik closed 2 years ago

mtrnik commented 2 years ago

Hello I am getting following error:

..../app/node_modules/capacitor-music-controls-plugin-new/android/src/main/java/com/gokadzev/capacitormusiccontrols/MusicControlsNotification.java:256: error: cannot find symbol resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_MUTABLE); ^ symbol: variable FLAG_MUTABLE location: class android.app.PendingIntent

Do you know what is causing the issue and how to fix that?

Screenshot 2022-06-17 at 12 06 20 Screenshot 2022-06-17 at 12 05 52

gokadzev commented 2 years ago

@mtrnik Hello, have you used "Sync project with gradle files" or capacitor sync after installing package?

mtrnik commented 2 years ago

@gokadzev no, should I?

gokadzev commented 2 years ago

@gokadzev no, should I?

yes, are you using ionic?

mtrnik commented 2 years ago

@gokadzev yes I am using Ionic-Vue

I synced project with gradle files but still the same error message in console. (MainActivity.java looks visually good now)

gokadzev commented 2 years ago

@mtrnik try to run ionic cap sync in project root folder with terminal (not in android folder)

mtrnik commented 2 years ago

@gokadzev I did that several times before

gokadzev commented 2 years ago

@mtrnik i use this plugin in ionic project for test as well but there's not any error. maybe you need to clear cache with rm -r $HOME/.gradle/caches/ from terminal and reopen project.

patrickjquinn commented 2 years ago

I just ran a clean -> build and this was resolved for me FYI

sanderschnydrig commented 2 years ago

I'm getting the same error, cleaning project didnt help, as well as @gokadzevs proposal

gokadzev commented 2 years ago

@mtrnik @sanderschnydrig what's your compile sdk version?

sanderschnydrig commented 2 years ago

I'm not getting this error anymore after invalidating caches and setting

compileSdkVersion = 31
targetSdkVersion = 31

in the variables.gradle file.

@gokadzev thanks, wish I saw your comment earlier.

FloryanFilip commented 2 years ago

@gokadzev what if we want to target 30?