douhuiwan5141 2019-05-21 22:20
浏览 254
已采纳

Gomobile库使用隐藏的API方法

I have an Android application which uses a Golang library (.aar) created with Gomobile. Anytime the application tries to create an instance of a class from the library or calls a library method it crashes with the next log message:

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 method is located in Google's light greylist (line 349). I know it's impossible to access any hidden method on SDK version 28 and higher, that's why I wrote the next in build.gradle (26 is the least version for Play Market):

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

But it didn't help. How to make it work? Remarks: test device is Nexus S emulated on Ubuntu 18.04.

  • 写回答

1条回答 默认 最新

  • drg5577 2019-07-14 09:14
    关注

    The problem is that I debugged my application on the emulator. Apparently, it's incompatible with native libraries. Debugging on a phone is alright.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型