0

Here I want to make a whole android project as jar file which is further used in Unity. My android project is like http://www.truiton.com/2015/05/capture-record-android-screen-using-mediaprojection-apis/ .

http://answers.unity3d.com/questions/330809/integration-of-jar-file-using-jni.html

And main things is that how can I make this whole project as jar file.

// How can i do that
package jni;     

public class TestClass 
{
 private String a;     
 public TestClass()
 {
     a="Hi all";
 }

 public String func()
 {
     return a;
 }
 }
halfer
  • 19,824
  • 17
  • 99
  • 186
User007
  • 1
  • 2

1 Answers1

0

If you want to make a whole android project as jar file, I think what you need is an aar file, which will contain all your build files (the java files and res files),

You can choose the "Android Library" type in File > New Module to create a new Android Library.

If your library is set up as an Android library (i.e. it uses the apply plugin: 'com.android.library' statement in its build.gradle file), it will output an .aar when it's built. It will show up in the build/outputs/aar/ directory in your module's directory.

Babajide Apata
  • 671
  • 6
  • 18
  • Thanks for your reply.can u explain in detail? – User007 Aug 25 '16 at 07:03
  • An aar file is a android library file, it can include everything needed to build an app, including source code, resource files, and an Android manifest. However, instead of compiling into an APK that runs on a device, an Android library compiles into an Android Archive (AAR) file that you can use as a dependency for an Android app module. checkout this [tutorial](https://developer.android.com/studio/projects/android-library.html) for more insight cheers – Babajide Apata Aug 25 '16 at 08:18