lukegjpotter lukegjpotter - 1 year ago 121
Android Question

Android Studio - GoogleAuthUtil cannot be resolved

I'm using Android Studio.

I need to use Google Accounts, but I'm getting an error.

Cannot resolve symbol 'GoogleAuthUtil'

I've imported the four main imports.


Here's how I'm calling it.

final Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);

My AndroidManifest.xml has the following.

android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NETWORK" />

I selected Android 4.3 (Revision 18) Google APIs when starting my project.

Should I have the GooglePlayServices.jar in my libs folder? How do I do this in Android Studio?

I've tried restarting Android Studio, after trying to follow steps in this other question about Eclipse: GoogleAuthUtil cannot be resolved.

Answer Source

This is a dup of a few other questions however:

Assure you have followed the documentation, make sure you have installed the Extras/Google Repository from the SDK Manager and added the following dependency to your <project>/<modulename>/build.gradle file (not the root .gradle file):

dependencies {
    compile ''

Next sync your project and Gradle files using sync then rebuild your project.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download