Reputation: 97
How do I add a System library to the Android Studio?
eclipse >
Adding the system library
Properties - Java Build Path - Libraries - Add Library - User Library - New - System library check - Done
Apply
Preference - Java Build Path - Order and Export
How to do this on Android Studio 1.2 ?
Upvotes: 2
Views: 2361
Reputation: 843
There is no easy way like Eclipse provide. You have to write a script into root project's build.gradle Here is mine(Mac env). It works with Android Studio 2.1.2 and Gradle 2.1.2
project(':YOUR_APP_PROJECT'){
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p'
+':/Users/YOU/SYS_LIB/framework-classes-full-debug.jar'
+':/Users/YOU/SYS_LIB/core-classes-full-debug.jar'
)
}
}
}
================UPDATE===================
project(project.path){
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
String sysLib = ":"+project.projectDir.path+"/sysLibs/"
String frameworkClasses="framework-classes-full-debug.jar"
options.compilerArgs.add('-Xbootclasspath/p'+sysLib+frameworkClasses')
}
}
}
Upvotes: 2
Reputation: 147
In Android Studio you need to Import as module.
if you have library project
1. File --> New --> Import Module--> give the library project path.
and add it module dependency
if you have library file
2. File --> Project Structure --> select the module "app" then go Dependencies tab click on Plus ( + ) you will see three option
1. Library dependency.
2. file dependency.
3. Module dependency.
Add whichever system Library you have in it.
Upvotes: -1