Reputation:
I have used IDEA IntelliJ to export a JAR file with public interfaces. Now I am trying to create another JAR file that implements the interfaces. This JAR file is ultimately meant to be dropped into an Android Studio project. The classes inside this JAR file will lean heavily on the Android SDK and Google APIs (meaning it will import
from the SDK).
How would I create this JAR file in Android Studio? I have tried New Module -> Android Library and I was surprised to find a project with a manifest, leading me to question what I actually created. Contrarily, do I simply create a Java Library and manually add the Android SDK as a dependency? How would I go about doing that?
Upvotes: 0
Views: 76
Reputation: 1115
Android libraries can be distributed as either a traditional JAR or an Android Archive (AAR). AAR libraries have the advantage of being able to include non-java files (such as resources, assets, or native libraries). Creating an Android library in Android Studio will set up gradle scripts to package an AAR. You can use this archive similarly to a jar.
When importing an AAR into an application, the library's AndroidManifest.XML is merged with the application's. This allows the library to declare activities, services or permissions.
See http://tools.android.com/tech-docs/new-build-system/aar-format for details.
Upvotes: 1