1

Upgrading Android version to 31 I get a new error with expo-facebook:

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

I tried to add implementation 'androidx.work:work-runtime-ktx:2.7.0' as specified in this SO thread but I still get the error.

What other solution than downgrading the target Android version do I have?

Simon
  • 6,025
  • 7
  • 46
  • 98

1 Answers1

2

Add these lines in android/app/build.gradle:

dependencies {
.....
implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation 'com.facebook.android:facebook-android-sdk:12.3.0'

}

And then look for these files and lines, and modify them too.

/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt

Line (463): PendingIntent.FLAG_UPDATE_CURRENT

Modify to: PendingIntent.FLAG_IMMUTABLE

/node_modules/expo-task-manager/android/src/main/java/expo/modules/taskManager/TaskManagerUtils.java

Line (463): PendingIntent.FLAG_UPDATE_CURRENT

Modify to: PendingIntent.FLAG_IMMUTABLE

/node_modules/expo-location/android/src/main/java/expo/modules/location/services/LocationTaskService.java

Line (463): PendingIntent.FLAG_UPDATE_CURRENT

Modify to: PendingIntent.FLAG_IMMUTABLE

Then just run the command for installation on the simulator or device that will work 100%

Uyric
  • 646
  • 7
  • 17