How to import Maven dependency in Android Studio/IntelliJ?

后端 未结 5 419
后悔当初
后悔当初 2020-11-29 18:54

I\'ve created a new Android project using the default wizard in Android Studio. Compiled, and deployed the app to my device. All is well.

Now I want to import an ext

5条回答
  •  旧巷少年郎
    2020-11-29 19:23

    As of version 0.8.9, Android Studio supports the Maven Central Repository by default. So to add an external maven dependency all you need to do is edit the module's build.gradle file and insert a line into the dependencies section like this:

    dependencies {
    
        // Remote binary dependency
        compile 'net.schmizz:sshj:0.10.0'
    
    }
    

    You will see a message appear like 'Sync now...' - click it and wait for the maven repo to be downloaded along with all of its dependencies. There will be some messages in the status bar at the bottom telling you what's happening regarding the download. After it finishes this, the imported JAR file along with its dependencies will be listed in the External Repositories tree in the Project Browser window, as shown below.

    enter image description here

    Some further explanations here: http://developer.android.com/sdk/installing/studio-build.html

提交回复
热议问题