androidgoandroid-ndkaargomobile

Gomobile library uses hidden API method


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.


Solution

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