Android can only be called from within the same library group prefix (referenced groupId=androidx

告警提示

ArgbEvaluator.getInstance can only be called from within the same library group prefix (referenced groupId=androidx.vectordrawable with prefix androidx from groupId=SchoolFacePay)
Inspection info:This API has been flagged with a restriction that has not been met. Examples of API restrictions: * Method can only be invoked by a subclass * Method can only be accessed from within the same library (defined by the Gradle library group id) * Method can only be accessed from tests. You can add your own API restrictions with the @RestrictTo annotation.

告警代码

private void initGradualAnim() {

        @SuppressLint("Recycle") ValueAnimator colorAnim
                = ObjectAnimator.ofInt(lcPayBack, "backgroundColor", BLUE, GREEN);
        colorAnim.setDuration(8000);
        colorAnim.setEvaluator(ArgbEvaluator.getInstance());
        colorAnim.setRepeatCount(ValueAnimator.INFINITE);
        colorAnim.setRepeatMode(ValueAnimator.REVERSE);

    }

告警位置

Android can only be called from within the same library group prefix (referenced groupId=androidx_第1张图片

解决办法 一

在方法前面添加

@SuppressLint("RestrictedApi")

具体

@SuppressLint("RestrictedApi")
    private void initGradualAnim() {

        @SuppressLint("Recycle") ValueAnimator colorAnim
                = ObjectAnimator.ofInt(lcPayBack, "backgroundColor", BLUE, GREEN);
        colorAnim.setDuration(8000);
        colorAnim.setEvaluator(ArgbEvaluator.getInstance());
        colorAnim.setRepeatCount(ValueAnimator.INFINITE);
        colorAnim.setRepeatMode(ValueAnimator.REVERSE);

    }

你可能感兴趣的:(Android,Java,android)