- Home /
Android plugin dependency
Recently I am trying to import my Android activity into Unity.
It is a simple recording function depending on javacpp, opencv,
Currently, my project structure app/src/main/JniLibs/armeabi-v7a/(arm-plugins for ffmpeg and opencv) and app/libs/ffmeg.jar, javacpp.jar, javacv.jar
After I export my project as AndroidPlugin.jar Do I also need to copy paste those libs? Where to place those libraries? Also I am confused how to place res folder including layout.xml and string.xml, etc
My current stucture:
Answer by liortal · Jul 16, 2016 at 04:19 PM
You should check out the documentation on building & using Android plugins.
When it comes to Android plugins, you have a few choices:
JAR files - a compressed file with compiled Java classes (e.g: code)
AAR files - Android archive, also a compressed file that contains code as well as other resources
Android library projects - A folder structure, the same as the one used to create an .AAR file, but still in its original form (not compiled into an .aar). All source files should be pre-compiled under bin/ or libs/ folder as far as i remember.
Regarding your specific scenario - you say that you compiled your code into a .JAR, but these files do not contain any resources. If you have your own layouts, or specific values, images, etc under the res/ folder, these will not be added to the .JAR file.
What you can do is compile your entire library to an .AAR file. This will contain everything under res/ , all the libraries, etc. Then add this file to your Android project (under Assets/Plugins/Android). This should be automatically identified by Unity as an Android plugin. When building your project it will add this library to the final game package.