4

I have imported an external jar-library find-local-devices.jar into Android Studio project. I've put it into libs folder, right-clicked and chosen Add as library, ensured about dependency in build.gradle, cleaned and built again the project - everything as described, e.g., here. , but I cannot still use the classes from jar:

enter image description here

Could somebody tell me what I do wrong?

Community
  • 1
  • 1
Spectorsky
  • 608
  • 4
  • 23

3 Answers3

3

Try "Invalidate Caches and restart" on Android Studio.

enter image description here

EDIT :

Also try deleting you current module and everything referring to it. And add it as the official google documentation is showing you too. The image is from here : https://developer.android.com/studio/projects/android-library.html

Community
  • 1
  • 1
James Oanta
  • 133
  • 1
  • 9
0
compile fileTree(dir: 'libs', include: ['*.jar'])

try this in gradle file and rebuild

Yongho
  • 21
  • 5
  • 1
    정용호, thanks for quick reply. My `build.gradle` already contains `compile fileTree(include: ['*.jar'], dir: 'libs')` in dependencies, and project was cleaned/rebuilt many times. – Spectorsky Mar 20 '17 at 07:40
0

Try another way of importing jar/aar packages into Android studio.

Goto File -> New Module -> import .JAR/.AAR package -> Select file path and say Finish.

Then add this line in Gradle.

compile project(':your_imported_file_name')