Java error when calling android mirror sdk from unity


I’m trying to call the mirror sdk from unity and I encounter a problem, when I call Display method I have a java exception and I don’t understand it (nor find an answer on web). You can find the entire error log here

In my Plugin/Android file I have:

  • context-0.1.6.aar
  • coresdk-1.0.6.aar
  • display-sdk-0.1.6.aar
  • mirrorcore-0.1.6.aar
  • sdk-1.0.6.aar
  • my aar file that do the bridge between C# and mirror android sdk

I use basic thing used in the SDK tutorial


NoSuchMethodError usually means that there is a library dependency problem. Newer library is using a method that is not implemented in older library that was linked.
For resolving dependencies in Android Studio, a gradle tool is used. So you only need to add com.estimote:display-sdk:0.1.6 and all required libraries will be downloaded automatically during build. No need to specify all libraries and their versions.
I’m not familiar with building Android apps with Unity, but there is something wrong with that list of dependencies because display-sdk:0.1.6 requires context:0.1.8. It looks like list of libraries were chosen because version number contains 0, 1 and 6.
You may try to include only display-sdk and clean your build to allow gradle to download correct libraries once again.
If you link aar libraries manually please follow version dependencies in their corresponding pom files (they should be in the same directory next to aar file).

I finally resolve the first problem with your solution, thanks.
But I encounter another one, I don’t know if it is your side or another plugin side, if you want to check, the error is here

And apparently, gradle for unity does not import other libraries.

Some parts of of SDK are written in Kotlin, which is compatible with Java on bytecode level. However it requires a small runtime library to be included. Usually Android Studio takes care of it and adds Kotlin support to gradle build files which then download library file. You can find line like this in gradle files:

compile `org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version`

If Unity builds does not resolve dependencies properly this is a serious issue. This is a major feature in gradle and resolving library dependencies manually is tedious and error prone. I would suggest to contact Unity support/forum with this issue.

I already triied this solution with no results :confused:
I will post this issue on Unity forum with the link here, maybe someone know.

Thanks :slight_smile: