This blog post is about how to add jar file in android studio project.  The below figure show default view of android studio project.  To add a jar file inside our project we need to copy the jar file inside libs directory. But here we are not able to see libs directory.

how to add jar file

  • To see the libs directory click the left side drop down menu “android” and choose “project” to see libs folders.

how to add jar file

  • copy the jar file and paste into libs directory.

how to add jar file in android studio

  • The last step is sync the project.

sync

Note:

There is a file called build.gradle inside app directory. if it contains following

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

look at “compile fileTree(dir: ‘libs’, include: [‘*.jar’])” , it is sufficient for adding jar file to compile with your android studio project. It is not present then inside dependencies write compile files(‘libs/cocos2d-android.jar’)

how to add jar file in android studio video instruction



Related Contents to follow