- Home /
Call android code which then calls a method in jar file
I need to call android code which in turn calls other jar which is linked to the project. like
unity code --> android jar (placed in assets/plugins/android folder) --> other.jar (which is added as a library in android jar).
when I call a normal method in other.jar it works fine but when I call any parametrized method it throws exception : "java.lang.NoSuchMethodError"
eg
unity() --> android() --> jar(); runs normally but unity -->android() --> jar(string) / jar(int) will throw exception.
Thank you
can you post the signatures of your java methods and how you call them from unity? my guess is that you're not passing parameters correctly
Answer by Yury-Habets · Dec 28, 2015 at 09:47 AM
All .jar files are collected during build postprocessing (including those in Assets/Plugins/Android, android libraries and AAR plugins) and merged together into a single classes.dex file.
Something must be wrong in your plugin setup. Please make sure you have all the .jars available, for android library projects make sure the .jar is in bin/ subfolder, and that the library project is added as expected (it should be as a subfolder in Assets/Plugins/Android, for example Assets/Plugins/Android/myandroidlibrary, which should contain project.properties, AndroidManifest.xml, bin/ etc.)
I crossed check there is no issue in setting plugin and copying all jars in assets/plugins/Android folder.
If this is the issue, then method without parameters would also had thrown exception, but in my case only parametrised method is throwing exception.