Search code examples
androidmavenstatic-libraries

How do i add a Static Library to Android Studio?


I've been trying to integrate this Midi Lib to my Android project without success. I've tried by manual importing it , linking it the same as this lib but it's giving me compile errors. I've also tried maven with no luck.

Error when adding the library as an external module (Added to libs folder in root of my project)

Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :libs:android-midi-lib-master.

my settings gradle :

include ':app'
include 'libs:android-midi-lib-master'

My build.gradle :

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':openCVLibrary320')
    compile project(':libs:android-midi-lib-master')
    compile files('libs/wekaSTRIPPED.jar')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.code.gson:gson:2.8.1'
    testCompile 'junit:junit:4.12'
}

Solution

  • My solution was to copy the create a new folder leff in my module . Then replace all occurrences of com.leff.midi with the my package name which in my case was com.benidobre.android.midi. After that no more import errors and I was able to run the app