Sahil Mathew Sahil Mathew - 3 months ago 6
Android Question

Error: package com.google.android.gms.appstate does not exist

Can't compile my android project because of this error.

/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java
Error:(32, 39) error: package com.google.android.gms.appstate does not exist
Error:(293, 28) error: cannot find symbol variable AppStateManager
Error:(294, 30) error: cannot find symbol variable AppStateManager
Error:Execution failed for task ':BaseGameUtils:compileReleaseJava'.



Compilation failed; see the compiler error output for details.
Information:BUILD FAILED


My gradle..

apply plugin:
'android-library' repositories
{
mavenCentral()
}
buildscript
{
repositories
{
mavenCentral()
}
dependencies
{
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
dependencies
{
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:+'
}
android
{
compileSdkVersion 21
buildToolsVersion '21.0.0'
defaultConfig
{
minSdkVersion 14
targetSdkVersion 23
}
productFlavors { }
}

Answer

I see that you have not specified the goggle play services library.

Instead of this

compile 'com.google.android.gms:play-services:+'

Try this

compile 'com.google.android.gms:play-services:7.8.0'

Note: You might have a different version so instead of 7.8 enter that.