Unity supports plug-ins for Android written in Java or Kotlin. This functionality allows you to add .java or .kt files into your Unity Project and they are compiled when you build an Android Player. Previously, you had to precompile these files as an Android library.
To compile the source files as a plug-in, follow these steps:
Note: You can place your source files in any folder in your Project except in special use locations such as StreamingAssets. If you place files in these locations, the Unity Editor will not display the plug-in inspector. For additional information, see AAR plug-ins and Android Libraries.
To enable direct referencing of the Java and Kotlin files in the exported gradle project and eliminte the need to manually copy the edited Java and Kotlin files from the exported gradle project to the Unity Project, enable Symlink Sources in the Build Settings window.