Контент и образцы кода на этой странице предоставлены по лицензиям. Java и OpenJDK – это зарегистрированные товарные знаки корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-08-15 UTC.
[null,null,["Последнее обновление: 2025-08-15 UTC."],[],[],null,["# How to add the SafetyNet API dependency\n\n| **Warning:** The SafetyNet Attestation API is deprecated and has been replaced by the [Play Integrity API](/google/play/integrity/overview). The SafetyNet reCAPTCHA API is being deprecated and replaced with [reCAPTCHA](https://cloud.google.com/recaptcha/docs/instrument-android-apps).\n\nThis page explains how to add SafetyNet APIs to your app.\n\nBefore you begin\n----------------\n\nTo prepare your app, first make sure that your app's build file uses the\nfollowing values:\n\n- A `minSdkVersion` of `19` or higher\n- A `compileSdkVersion` of `28` or higher\n\nThen complete the steps in the following sections.\n\nConfigure your app\n------------------\n\nIn your `settings.gradle` file, include\n[Google's Maven repository](https://maven.google.com/web/index.html)\nand [Maven central repository](https://search.maven.org/artifact)\nin both your `dependencyResolutionManagement` and `pluginManagement` repository sections: \n\n pluginManagement {\n repositories {\n ...\n google()\n mavenCentral()\n }\n }\n\n dependencyResolutionManagement {\n ...\n repositories {\n google()\n mavenCentral()\n }\n }\n\nAdd the [Google Play services](http://developer.google.com/android)\ndependency for the Google Play API to your\n[module's Gradle build file](/studio/build#module-level),\nwhich is commonly `app/build.gradle`: \n\n dependencies {\n implementation 'com.google.android.gms:play-services-safetynet:18.1.0'\n }\n\nMore information\n----------------\n\n**[SafetyNet Safe Browsing API](/training/safetynet/safebrowsing)**\n: Learn how the SafetyNet Safe Browsing API provides services for determining\n whether a URL has been marked as a known threat by Google.\n\n**[SafetyNet reCAPTCHA API](/training/safetynet/recaptcha)**\n: Learn how the SafetyNet reCAPTCHA API protects your app from malicious\n traffic.\n\n**[SafetyNet Verify Apps API](/training/safetynet/verify-apps)**\n: Learn how the SafetyNet Verify Apps API protects devices against potentially\n harmful apps.\n\nAdditional resources\n--------------------\n\n- [Security tips](/training/articles/security-tips)\n- [Compatibility Test Suite (CTS)](https://source.android.com/compatibility/cts)"]]