SikuliXUser SikuliXUser - 1 year ago 67
Android Question

"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 ''
compile ''
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
directly, nothing changed. Imports still do not work.

Answer Source

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.