【问题标题】:4 Errors - error: package com.google.android.gms.appstate ETC4 错误 - 错误:包 com.google.android.gms.appstate ETC
【发布时间】:2016-06-17 04:43:49
【问题描述】:

我对此很陌生,如果有人愿意为我真正愚蠢地解决这个问题,我会很高兴。我不断收到这 4 个错误,这非常令人沮丧。

我目前在 Mac 上使用 Android Studio。当我尝试创建构建并尝试在线搜索此问题时会弹出这些错误,但这就是我找到的 LINK 并且仍然没有帮助。

/Users/name/Desktop/test/game/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 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. Error:Execution failed for task ':BaseGameUtils:compileDebugJava'.
 > Compilation failed; see the compiler error output for details.

这不允许我创建任何构建

信息:构建失败

 /Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:32: error: package com.google.android.gms.appstate does not exist
    import com.google.android.gms.appstate.AppStateManager;
                                          ^
    /Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:293: error: cannot find symbol
                builder.addApi(AppStateManager.API);
                               ^
      symbol:   variable AppStateManager
      location: class GameHelper
    /Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:294: error: cannot find symbol
                builder.addScope(AppStateManager.SCOPE_APP_STATE);
                                 ^
      symbol:   variable AppStateManager
      location: class GameHelper
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    3 errors

     FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':BaseGameUtils:compileDebugJava'.
    > Compilation failed; see the compiler error output for details.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

【问题讨论】:

  • 您必须发布产生这些错误的代码,并说明您尝试修复它们的方法。
  • 我已经用更多信息编辑了这个问题,我不确定这是否有很大帮助。请告诉我。

标签: java android compiler-errors package


【解决方案1】:

看来:

  1. com.google.android.gms.appstate 包未找到。您尚未将其链接到您的程序。
  2. AppStateManager 无法识别,但这是第一个错误的结果。

【讨论】:

  • 我该如何链接它?
  • 通常在你的IDE中,如果你点击你的项目,你可以添加/链接其他项目的jar文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-12-06
  • 2018-08-13
  • 2019-06-26
相关资源
最近更新 更多