SikuliXUser
SikuliXUser

Reputation: 53

"Add as Library" button missing?

Trying to add external library jars to my project, but imports still don't work. Tutorials keep telling me to click "Add as library", but I don't have that option:

Missing Add as Library button

But I did add them through Module Settings...

Module Settings

I also added the 2 .jar files to: /src/main/libs/ and added this to build.gradle inside 'app'.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    --> compile files('src/main/libs/jsonbeans-0.5.jar')
    --> compile files('src/main/libs/kryo-2.23.1-SNAPSHOT-all-debug.jar')
}

What else can I try to fix this? I don't understand why imports just don't work since the files are included in my build.gradle.

Edit: After changing the directory from /src/main/libs/ to /libs/ directly, nothing changed. Imports still do not work.

Upvotes: 1

Views: 1236

Answers (1)

Code-Apprentice
Code-Apprentice

Reputation: 83537

The libs folder should be a subfolder of app. Instead you have it buried in app/src/main. Note that you already have a dependency for the libs folder if you put it in the correct place.

When you use a file manager or the command line to move files to your Android Studio project, you sometimes need to synchronize the folder structure by right clicking in the Project pane and clicking Synchronize in the popup menu.

Upvotes: 3

Related Questions