[Solved] How to Solve the Flutter PackageManager has been Deprecated in 2023

I have got an error: “Flutter PackageManager has been Deprecated“. After upgrading the compileSdkVersion 33 and targetSdkVersion 33, flutter get an error.

Flutter PackageManager has been Deprecated

Launching lib/main.dart on Redmi Note 9 Pro in debug mode...
/home/aman/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java:75: warning: [deprecation] queryIntentActivities(Intent,int) in PackageManager has been deprecated
            List<ResolveInfo> callAppsList = pm.queryIntentActivities(callIntent, 0);
                                               ^
error: warnings found and -Werror specified
/home/aman/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:317: warning: [deprecation] getPackageInfo(String,int) in PackageManager has been deprecated
                    .getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
                    ^
1 error
2 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':permission_handler: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 5s
Running Gradle task 'assembleDebug'...                             66.7s
Exception: Gradle task assembleDebug failed with exit code 1

This means that the permission handler is using a deprecated package. If you use the flutter 3.0 + and the latest version of compileSdkVersion 33 and targetSdkVersion 33, you may face this error. In this case, you have to change the permission handler in pubspec.yaml to any

Pubspec.yaml

permission_handler: any

This is how you can solve this Flutter PackageManager has been Deprecated issues.

Read More:

Flutter AppBar Example

Related articles

[Solved] Fix Unable to Load Asset Flutter in 2 Ways (2023)

Do you face the Unable to Load Asset Flutter...

Fix Flutter Remove REQUEST_INSTALL_PACKAGES Permission From Play Console in 2023

Do you get any issues like "Flutter Remove REQUEST_INSTALL_PACKAGES Permission...

Case Studies

eDental App

Case Study: eDental Dentist App

Our team recently embarked on an exciting project to develop the eDental Dentist App, a cutting-edge mobile application designed for both Android and iOS...

Voltage Lab SAAS App

Voltage Lab is an Electrical & Electronics Website and App that they wanted to launch a new SAAS app that would allow students to...
google play app store listing

Keyword Research for EEE & Cricket Live Score App

A Cricket Live Score App & Voltage Lab EEE Engineer App aimed to enhance their visibility on Google and the iOS app store, seeking...