简体   繁体   中英

Error while adding library to Android Studio

I have been trying to add a library to android studio and have encountered a few problems. I have looked everywhere and didn't find the solution. 错误屏幕

I'd like to add this library ( https://github.com/lucasr/twoway-view/ ) to my project but when I past this line to build.gradle that error occurs

repositories {

 maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } 

}

dependencies {

 compile 'org.lucasr.twowayview:core:1.0.0-SNAPSHOT@aar' compile 'org.lucasr.twowayview:layouts:1.0.0-SNAPSHOT@aar' 

}

Pls help me because I have no idea what to do.

You put the statements in the wrong places. Here's how to fix that:

maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }

This line above should be in this build.gradle , but inside the allprojects { repositories { ... } } , so like this:

allprojects {
    repositories {
        jCenter()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }
}

Then make sure you removed the dependencies { ... } part from this file. In your app folder there is another build.gradle . Open that one, and on the bottom you should see a dependencies { ... } already (probably with the AppCompat library).

Now insert these two lines inside that dependency { ... } clause:

compile 'org.lucasr.twowayview:core:1.0.0-SNAPSHOT@aar'
compile 'org.lucasr.twowayview:layouts:1.0.0-SNAPSHOT@aar'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM