Boardy
Boardy

Reputation: 36205

Referencing Existing Library Project into Main Project

I am trying to make use of Android Studio, currently using Eclipse.

I have exported my Library project for gradle, and then imported my exported project into Android Studio. This is successful, however I then can't find how I can go to my main applications project and reference the newly imported library. Everything I've found looking though Android Studio, always seems to be for creating a new library project, not referencing an existing project.

I am using Android Studio 0.4.0.

Thanks for any help you can provide.

UPDATE

I've looked at what @Grennis said, but I do not have a library section under the Project Structure Dialogue. Below is a screenshot of my project structure dialogue.

Project Structure Dialogue

UPDATE 2

I've been trying to modify the gradle files manually, I've read that the library needs to be copied to my project and then reference it within the gradle files. I think this may be sort of working as I kept on getting errors stating that it couldn't find the library, however, I am no longer getting that error and I'm getting a different one instead.

The error is:

A problem occurred configuring project ':MysqlManager'.

Configuration with name 'default' not found.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Below is my settings.gradle

include ':MysqlManager'
include ':Libraries:CritiMon'

Below is my build.gradle file

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile project(':Libraries:CritiMon')
//    compile project(':Libraries:NavigationDrawerManager')
//    compile project(':Libraries:BoardiesITSolutionsLib')
}

Below is a screenshot showing my directory structure

Project structure

Upvotes: 0

Views: 811

Answers (2)

Greg Ennis
Greg Ennis

Reputation: 15379

Select your project and then in the menu select File -> Project Structure

In the "Libraries" section you can add existing libraries

Then in the "Modules" section, under the "Dependencies" tab, you can add those libraries to the project.

Upvotes: 0

Related Questions