【问题标题】:Android Studio cannot access the function in the other classAndroid Studio 无法访问其他类中的函数
【发布时间】:2016-07-17 10:24:47
【问题描述】:

我在module_A中有一个带有公共函数“go()”的类A,当我在module_B中使用A a=new A()时, 它工作得很好。但是当我调用函数“a.go()”时,android studio会写出你无法访问包“xxxxxxxxx”的错误消息;

在module_B中,我已经在build.gradle文件中编写了编译项目(“:module_A”);

【问题讨论】:

  • module_B 需要与 module_A 相同的依赖在 "go()" 范围内

标签: android android-studio gradle


【解决方案1】:

重建你的模块。然后如果它不起作用,您可以在Android StudioFile 菜单中使用Invalidate Caches/ Restart

【讨论】:

    【解决方案2】:

    要修复此错误,您可以尝试从 android studio 的“文件”菜单中执行“无效缓存/重新启动”选项。选择“Invalidate and restart option”并关闭 Android Studio。

    此外,请在此处查看答案: https://stackoverflow.com/a/68736360/13794189

    【讨论】:

      猜你喜欢
      • 2021-10-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多