Stay organized with collections Save and categorize content based on your preferences.
PrerequisitesThe Google Cast SDK for Android is part of the Google Play services SDK and does not need to be downloaded separately.
Note: Google Play services gives you access to a range of APIs for building ads, collecting analytics, authenticating users, integrating maps, and much more. For more information, see Overview of Google Play Services. It is important for you to ensure that the correct Google Play services APK is installed on a user's device since updates might not reach all users immediately.
Note: Since the libraries contribute resources, you cannot simply satisfy the dependencies by including their JAR files; instead you need to import them as library projects for your IDE. Add Google Play Services to your projectSelect your development environment below and add Google Play services to your project by following the steps provided.
Android StudioTo make the Google Play services APIs available to your app:
build.gradle
file inside your application module directory.
Note: Android Studio projects contain a top-level build.gradle
file and a build.gradle
file for each module. Be sure to edit the file for your application module. See Building Your Project with Gradle for more information about Gradle.
google()
is included in the listed repositories
.
repositories {
google()
}
dependencies
for the latest version of play-services
. For example:
apply plugin: 'com.android.application' ... dependencies { implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.mediarouter:mediarouter:1.2.5' implementation 'com.google.android.gms:play-services-cast-framework:22.0.0' }
Be sure you update this version number each time Google Play services is updated.
Note: If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable.
To make the Google Play services APIs available to your app:
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
to the location where you maintain your Android app projects.Note: You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory.
<application>
element:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Once you've set up your project to reference the library project, you can begin developing features with the Google Play services APIs.
Create a Proguard exceptionTo prevent ProGuard from stripping away required classes, add the following lines in the /proguard-project.txt
file:
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } -keepnames class * implements android.os.Parcelable -keepclassmembers class * implements android.os.Parcelable { public static final *** CREATOR; } -keep @interface android.support.annotation.Keep -keep @android.support.annotation.Keep class * -keepclasseswithmembers class * { @android.support.annotation.Keep <fields>; } -keepclasseswithmembers class * { @android.support.annotation.Keep <methods>; } -keep @interface com.google.android.gms.common.annotation.KeepName -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } -keep @interface com.google.android.gms.common.util.DynamiteApi -keep public @com.google.android.gms.common.util.DynamiteApi class * { public <fields>; public <methods>; } -dontwarn android.security.NetworkSecurityPolicy
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[[["Ensure you have the latest Android SDK, appcompat, mediarouter AndroidX Libraries, and Google Cast SDK installed via the Android SDK Manager."],["Add Google Play Services to your project by modifying your `build.gradle` file (Android Studio) or referencing the library project and updating the manifest (Other IDEs)."],["If using ProGuard, include specific exceptions in your configuration file to prevent the removal of necessary Google Play services classes."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3