-2

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

在此处输入图像描述

这是日志,

> 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

有人可以解释一下这是什么意思吗?

4

1 回答 1

0

这意味着这些方法和类已被弃用

提供方法或类的人正在标记他们打算在将来的版本中删除它们……无论当前提供它们的库是什么。警告是告诉您,建议您修改此代码以使用这些方法的替代方法。

通常,弃用通知(在 javadocs 中)会建议一些替代方案。例如,javadocsGooglePlayServicesUtil.getErrorDialog

此方法已弃用。

改为使用getErrorDialog(Activity, int, int, OnCancelListener)

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

于 2020-04-02T10:49:02.510 回答