How to add this library project to Android Studio?

How to add library to Android Studio 0.5.4 project

  • What is the best way to add https://github.com/MichaelEvans/ChromaHashView?utm_source=Android%20Weekly&utm_campaign=72e995e0c6-Android_Weekly_97&utm_medium=email&utm_term=0_4eb677ad19-72e995e0c6-337844257 sexy library (which does not use maven yet) to my project? I see an 'import module' and 'import project' option under the File menu, so I assume I should use one of these? I have tried with both and while the project source does pop up in Android Studio I cannot use any of the library content. There are many questions on SO regarding importing libraries to Android Studio, but most either use a project which has a jar file, or are using a much older version so I'm not too sure how to do this. http://stackoverflow.com/questions/16983364/android-studio-add-project-as-library seems similar to mine, I have tried to import the folder as a module, and added this to my build.gradle: compile project(':ChromaHashView:library') And this popped up in the settings.gradle include 'ChromaHashView' But I get an error saying the ':ChromaHashView:library' could not be found in my project.

  • Answer:

    What's in the include statement in your settings.gradle file has to match what's in the compile project statement in your build.gradle. So: build.gradle dependencies { compile project(':ChromaHashView:library') } settings.gradle include ':ChromaHashView:library' The ChromaHashView project is a standalone Gradle project with a build.gradle, settings.gradle and Gradle wrapper at its project root, and two modules (demo and library). However, to include the modules in a different project, you have to bypass its root-level build and settings files and include the submodules directly as submodules in your target project, which is what you're doing with the modifications above. Another way of saying that is that Gradle only supports one settings.gradle file per project, and the Android Studio project already has one, so to include new modules you have to merge the changes into the existing settings file.

Daniel Wilson at Stack Overflow Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.