Error: package com.google.android.gms.appstate does not exist
Error: package com.google.android.gms.appstate does not exist
由于这个错误,无法编译我的 android 项目。
/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
我的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 { }
}
首先你应该检查 /extras/google/google_play_services/libproject/google-play-services_lib> 是否存在。
其次在build.gradle
中添加代码
compile 'com.google.android.gms:play-services:5.+'
您缺少 com.google.android.gms.appstate 包。你应该把这个添加到你的应用程序中。为此,将 compile 'com.google.android.gms:play-services:5.+'
添加到您的 build.gradle(Module:app).
我看到你没有指定goggle play服务库。
而不是这个
compile 'com.google.android.gms:play-services:+'
试试这个
compile 'com.google.android.gms:play-services:7.8.0'
注意:您可能有不同的版本,所以不要输入 7.8。
不好意思,我用的版本太高了:
compile "com.google.android.gms:play-services:10.2.1"
我改成了:
compile "com.google.android.gms:play-services:7.+"
有效,但我不知道为什么 appstate
不包含在 7
以上的版本中
由于这个错误,无法编译我的 android 项目。
/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
我的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 { }
}
首先你应该检查 /extras/google/google_play_services/libproject/google-play-services_lib> 是否存在。
其次在build.gradle
中添加代码compile 'com.google.android.gms:play-services:5.+'
您缺少 com.google.android.gms.appstate 包。你应该把这个添加到你的应用程序中。为此,将 compile 'com.google.android.gms:play-services:5.+'
添加到您的 build.gradle(Module:app).
我看到你没有指定goggle play服务库。
而不是这个
compile 'com.google.android.gms:play-services:+'
试试这个
compile 'com.google.android.gms:play-services:7.8.0'
注意:您可能有不同的版本,所以不要输入 7.8。
不好意思,我用的版本太高了:
compile "com.google.android.gms:play-services:10.2.1"
我改成了:
compile "com.google.android.gms:play-services:7.+"
有效,但我不知道为什么 appstate
不包含在 7