You can create a jar file using Android Studio. 
Just add these tasks in your app's build.gradle file.

    //task to delete the old jar
    task deleteOldJar(type: Delete) {
        delete 'build/libs/AndroidPlugin.jar'
    }
     
    //task to export contents as jar
    task exportJar(type: Copy) {
        from('build/intermediates/bundles/release/')
        into('release/')
        include('classes.jar')
        ///Give whatever name you want to give
        rename('classes.jar', 'AndroidPlugin.jar')
    }
     
    exportJar.dependsOn(deleteOldJar, build)

Once you add the above lines you can export the jar using the task of the 
same name.
You can go through the post here on How to create an Android Plugin For 
Unity using Android Studio 
<http://www.thegamecontriver.com/2015/04/android-plugin-unity-android-studio.html>

On Tuesday, February 24, 2015 at 1:03:03 PM UTC+5:30, Ernest Holloway wrote:
>
> Hi Everyone,
>
> Is there an official Google supported way of being able to simply and 
> quickly compile an Android library project into a JAR file? On Eclipse you 
> could do this easily by building the project as long as your target API was 
> >14. There were some provisions to be made such as removing switch 
> statements, however, the process was pretty painless. 
>
> Please let me know if there is an obvious way to do this with Android 
> studio and if I am missing something. Most of the postings that I have 
> found on Stack Overflow have been to either:
>
> 1) Generate an .aar file, which seems to only work best and be fully 
> supported with Android studio. I am not sure if .aar files are fully 
> supported with Eclipse since Google has officially stopped support of 
> Eclipse.
>
> 2) Modify the gradle files somehow to get a .jar file to build instead of 
> the .aar file. 
>
> If anyone knows of a plugin or at least a good set of directions to point 
> me in the right direction I would greatly appreciate it. I am developing a 
> library and the .JAR file is a requirement so that folks using Android 
> Studio or Eclipse can still utilize the library.
>
> Thank you all for your help,
>
> -Ernest
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to