You can! but in this way you have some advantage and disadvantage , Important disadvantage is lack of security by adding all Beans into android , maybe I'm wrong thinking in open world.
But here Steps for using Java Beans(EJB) or Java Library that need share with android , webapp , desktop app and etc...
in eclipse way match easier to do that , by the way in this year I use intellij so Given example of what I'm doing for app I create.
About structure if we have:
- Project/MyEnterpriseProject/Webapp
- Project/MyEnterpriseProject/Android
- Project/MyEnterpriseProject/Desktop
- Project/MyEnterpriseProject/NativeTools
- Project/MyEnterpriseProject/Ejb
The Steps:
- One Go to Main App(Desktop or WebbApp) create/import Module from out side of project root called ejb or some library you need shared. example :
Project/MyEnterpriseProject/Webapp the main root project is MyEnterpriseProject
->So I add NativeTools and Ejb
- Add The NativeTools/Ejb as maven Library to web Application and Desktop Application by using maven(not jar file)
- set into pom file of NativeTools/Ejb packaging as jar(so you finish for web or desktop and you can use and update from one intellij project But can't use in android studio! go for step 4
- In Main Project (can desktop or webapplication) Add artifacts for NativeTools/Ejb set destination whatever you want , but I use target folder in NativeTools/Ejb folder. build artifacts and compiled project if any problems shows , use maven view in intellij and click genrat src and doc and than click reload all project after that click on build artifacts.
- go to android studio or any Ide add jar files you build from NativeTools/Ejb , in android studio just go to build.gradle and see this post (https://stackoverflow.com/a/25660287/10992709) :
dependencies {
implementation files('libs/your jar file.jar')
}
- Change the libs/your jar file.jar to your placed NativeTools/Ejb jar file.
- if you need to update the NativeTools/Ejb you need rebuild and create artifact from main project , than you can use it from other IDE.