How to add classpath in an Android Studio project

后端 未结 3 1430
天命终不由人
天命终不由人 2020-12-10 08:33

I have an Android project with an Android application that depends on a pure Java library (and the Java library uses some others compiled jars libraries).
I added the de

相关标签:
3条回答
  • 2020-12-10 08:46

    Thanks to Arnold Layne, I created a folder named libs.

    Then, I went to

    Files -> Project Structure (new menu opens) -> Modules (on the left) -> app -> Dependencies

    There, I could add the library with the + Button.

    This created this entry:

    dependencies {
        implementation files('libs/commons-lang3-3.7.jar')
    }
    
    0 讨论(0)
  • 2020-12-10 08:51

    Add this lines to build.gradle of app module.

    dependencies {
        ...
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation files('libs/mysql-connector-java-8.0.16')
        ...
    }
    
    0 讨论(0)
  • 2020-12-10 09:05

    First off all, be sure there's a "libs" subfolder in the "app" folder of your project. If there's not, create one. Next, in the app/build.gradle file, add this line of code:

    dependencies {
        ...
        compile fileTree(dir:'libs', include: ['*.jar'])
        ...
    }
    

    Place all of your .jar files in the "libs" folder, and voila, you're done

    0 讨论(0)
提交回复
热议问题