【问题标题】:Gomobile library uses hidden API methodGomobile 库使用隐藏的 API 方法
【发布时间】:2019-05-21 22:20:35
【问题描述】:

我有一个 Android 应用程序,它使用由 Gomobile 创建的 Golang 库 (.aar)。每当应用程序尝试从库中创建类的实例或调用库方法时,它都会崩溃并显示下一条日志消息:

W/om.example.cal: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (greylist, reflection, allowed)
A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 11110 (om.example.calc), pid 11075 (om.example.calc)
Application terminated.

getInitialApplication 方法位于Google's light greylist (line 349)。 我知道在 SDK 28 及更高版本上无法访问任何隐藏方法,这就是为什么我在build.gradle 中写下一个(26 是 Play Market 的最低版本):

compileSdkVersion 26
minSdkVersion 15
targetSdkVersion 26
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.android.support:appcompat-v7:26.1.0'

但这并没有帮助。如何让它发挥作用? 备注:测试设备是在 Ubuntu 18.04 上模拟的 Nexus S

【问题讨论】:

    标签: android go android-ndk aar gomobile


    【解决方案1】:

    问题是我在模拟器上调试了我的应用程序。显然,它与本机库不兼容。在手机上调试没问题。

    【讨论】:

      猜你喜欢
      • 2017-10-31
      • 2015-05-02
      • 1970-01-01
      • 2018-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多