Jira software APIs used in app, fails to install app on Jira core

Hi, the question is regarding the Jira server app and agile plugin - our app currently works with all Jira applications including the core. Now we have to add some features, which require us to use “Jira software” or “agile” (previous greenhopper) java APIs. If we use the agile java APIs, app fails to install on Jira core where agile plugin is missing, since it does not find the used java classes and fails to initialize the beans in app.
Did anyone face such an issue? and if so, can you please share if you found any alternative so that we can have a single app jar that can support Jira core as well as Jira software?

This post helped fix the issue - Supporting older java api's when building for new versions