I recently encountered a frustrating issue while developing a Game Helper App that relies on Google Sign-In for authenticating players and integrating with Google Play Games Services.
Everything worked flawlessly on my physical device, but when I tried testing on Genymotion emulator, I hit a wall. The app failed to sign in using the Google+ button, and Logcat threw the following error:
Access Not Configured. Please use Google Developers Console to activate the API for your project.
...
Unable to sign in - application does not have a registered client ID
At first glance, the problem seemed mysterious. The same APK was working on one device and failing on another. But after some digging, the reason became clear and fixable.
Problem Breakdown
Here’s what was causing the Google Sign-In failure:
- Google Play Games Services API wasn’t enabled in my Google Cloud Console.
- I hadn’t correctly registered the OAuth 2.0 client ID tied to the SHA-1 fingerprint of my debug and release keys.
- Genymotion doesn’t support Google Play Services out-of-the-box, which is essential for sign-in.
Define a Solution
Enable Google Play Games API
I opened the Google Cloud Console, selected my project, and navigated to:
APIs & Services > Library > Google Play Games Services API > Enabl
e
Register OAuth Client ID with Correct SHA-1
I went to:
APIs & Services > Credentials > Create Credentials > OAuth 2.0 Client ID
I made sure to add both:
- Release SHA-1 (from my production keystore)
- Debug SHA-1 (for testing and emulator builds)
To get my debug SHA-1, I used the following command:
keytool -list -v \
-keystore ~/.android/debug.keystore \
-alias androiddebugkey \
-storepass android \
-keypass android
Emulator Troubleshooting
The key reason the error only appeared on Genymotion: it lacks Google Play Services by default. I had two choices:
- Flash GApps (Google Apps) manually onto the emulator.
- Use the official Android Emulator with Google APIs included (which I recommend for seamless integration).
The Working Code (Kotlin)
Once everything was set up, here’s the code I implemented for Google Sign-In integration:
class MainActivity : AppCompatActivity() {
private lateinit var googleSignInClient: GoogleSignInClient
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
findViewById<Button>(R.id.sign_in_button).setOnClickListener {
signIn()
}
}
private fun signIn() {
val signInIntent = googleSignInClient.signInIntent
startActivityForResult(signInIntent, RC_SIGN_IN)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RC_SIGN_IN) {
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
try {
val account = task.getResult(ApiException::class.java)
Toast.makeText(this, "Sign-in successful: ${account?.displayName}", Toast.LENGTH_SHORT).show()
// Proceed with game features
} catch (e: ApiException) {
Log.e("SignInError", "Sign-in failed: ${e.statusCode}")
Toast.makeText(this, "Sign-in failed: ${e.localizedMessage}", Toast.LENGTH_LONG).show()
}
}
}
companion object {
private const val RC_SIGN_IN = 9001
}
}
Extra Functionalities I Added
To make the app more complete and testable, I added a few more features:
Sign Out Functionality
findViewById<Button>(R.id.sign_out_button).setOnClickListener {
googleSignInClient.signOut().addOnCompleteListener {
Toast.makeText(this, "Signed out", Toast.LENGTH_SHORT).show()
}
}
Check Sign in Status Automatically
override fun onStart() {
super.onStart()
val account = GoogleSignIn.getLastSignedInAccount(this)
if (account != null) {
Toast.makeText(this, "Already signed in as: ${account.displayName}", Toast.LENGTH_SHORT).show()
}
}
Show Dialog for Missing Play Services
fun showPlayServicesError() {
AlertDialog.Builder(this)
.setTitle("Google Play Services Required")
.setMessage("Google Play Services are missing or outdated on this device. Please install or update it.")
.setPositiveButton("OK", null)
.show()
}
Key Takeaway
- Always enable necessary APIs from the Google Cloud Console before implementing services.
- Register both debug and release SHA-1 fingerprints in your project’s OAuth 2.0 credentials.
- Avoid using Genymotion for Google Sign-In unless you’ve explicitly added Google Play Services.
- Test sign-in status early in the app to avoid runtime confusion.
Final Thoughts
This bug taught me an important lesson not all errors are caused by code many stem from configuration issues on the backend. If your app relies on Google Services, your project setup matters as much as your codebase.
After following the steps above, sign-in worked seamlessly across all test devices. For client projects, I now maintain a clear checklist to ensure no key API is forgotten during setup.