Search code examples
javaandroidjfugue

How do you import a package in Android Studio?


I am extremely inexperienced with Android Studio - and am having an issue with my imports. I'm trying to build an app that creates music from an ArrayList of "note" objects (I've made this class - it has info on). I am trying to import midi driver (https://github.com/billthefarmer/mididriver) to play my music, but I keep getting an error when I try to write this:

import org.billthefarmer.mididriver;

in my code (specifically the Analyzer object I've made - you'll see it in the pic). Here is a pic of my project structure. I've added Midi Driver as a dependency to my build.gradle

implementation project(path: ':org.billthefarmer.mididriver')

in my app folder. I'm not sure what I'm doing wrong. I'm sorry to bother!

Here is the pic of my project structure Here is the pic of my project structure


Solution

  • You should add it in MyApp/app/build.gradle like this :

    dependencies {
        ....
        implementation 'com.github.billthefarmer:mididriver:v1.24'
        ....
    }