错误警告:PackageInfo 中的 [deprecation] signatures 已被弃用 (Signature signature:info.signatures)

Error warning: [deprecation] signatures in PackageInfo has been deprecated for(Signature signature:info.signatures)

我在编译时遇到这些错误。

这是日志,

> Task :app:compileDebugJavaWithJavac
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:198: warning: [deprecation] FusedLocationApi in LocationServices has been deprecated
        mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
                                        ^
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:249: warning: [deprecation] isGooglePlayServicesAvailable(Context) in GooglePlayServicesUtil has been deprecated
                .isGooglePlayServicesAvailable(this);
                ^
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:251: warning: [deprecation] isUserRecoverableError(int) in GooglePlayServicesUtil has been deprecated
            if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
                                      ^
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:252: warning: [deprecation] getErrorDialog(int,Activity,int) in GooglePlayServicesUtil has been deprecated
                GooglePlayServicesUtil.getErrorDialog(resultCode, this,
                                      ^
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:426: warning: [deprecation] GET_SIGNATURES in PackageManager has been deprecated
            PackageInfo info = getPackageManager().getPackageInfo(getPackageName() , PackageManager.GET_SIGNATURES);
                                                                                                   ^
C:\Users\HP\Desktop\FoodieRiderv1.0\FoodieRider1.1.1\FoodiesRider\app\src\main\java\com\foodies\rider\ActivitiesAndFragments\Activities\SplashScreenActivity.java:427: warning: [deprecation] signatures in PackageInfo has been deprecated
            for(Signature signature:info.signatures)
                                        ^
6 warnings

谁能解释一下这是什么意思?

表示那些方法和classes已经Deprecated

提供该方法或 class 的人表示他们 打算 在未来的版本中删除它们...无论它是什么库目前提供他们。警告是告诉您建议您修改此代码以使用这些方法的替代方法。

通常,弃用通知(在 javadoc 中)会提出一些替代方案。例如 GooglePlayServicesUtil.getErrorDialogjavadocs 表示:

This method is deprecated.

Use getErrorDialog(Activity, int, int, OnCancelListener) instead.

请注意,这些只是警告。您可以暂时忽略它们,尽管它们将来可能会出现问题。