Reputation: 4731
I am building an Android project. With the following gradle configuration. Everything was working fine. Until I tried adding lottie-android library in the project.
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ignite.a01hw909350.kolamdemo"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress 'KARMarker'
noCompress 'armodel'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':KudanAR')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'nl.dionsegijn:konfetti:1.0.2'
compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'
compile 'io.palaima:smoothbluetooth:0.1.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
compile 'com.flurgle:camerakit:0.9.17'
compile 'com.github.zhukic:sectioned-recyclerview:1.0.0'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.android.support:design:25.3.1'
compile 'com.github.barteksc:android-pdf-viewer:2.4.0'
compile 'org.rajawali3d:rajawali:1.1.668@aar'
compile 'com.tapadoo.android:alerter:2.0.0'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.github.GoodieBag:ProtractorView:v1.2'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.stepstone.stepper:material-stepper:3.3.0'
compile 'pub.devrel:easypermissions:0.4.3'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'com.github.apl-devs:appintro:v4.2.2'
compile 'com.airbnb.android:lottie:2.2.5'
testCompile 'junit:junit:4.12'
}
When I add compile 'com.airbnb.android:lottie:2.2.5'
in the gradle and compile. I am getting below error.
Error:Failed to resolve: com.android.support:appcompat-v7:26.1.0
I dont wanna update my sdk currently. How can avoid this error ?
Upvotes: 0
Views: 1634
Reputation: 7368
In your application build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
And then add the dependencie(s):
dependencies {
def supportLibrariesVersion = '26.1.0'
compile "com.android.support:support-compat:${supportLibrariesVersion}"
compile "com.android.support:cardview-v7:${supportLibrariesVersion}"
compile "com.android.support:recyclerview-v7:${supportLibrariesVersion}"
compile "com.android.support:gridlayout-v7:${supportLibrariesVersion}"
compile "com.android.support:design:${supportLibrariesVersion}"
}
Also, you've to do the following modifications to make it works:
compileSdkVersion 26
buildToolsVersion "26.0.1"
Upvotes: 3
Reputation: 21
Just a guess but maybe it fails because the appcompat-v7:26.1.0 lib (probably used by the lottie library) is newer then your build-tools version. Try raising your build-tools version to 26.0.1 and your compile sdkVersion to 26. Plus you are additionally trying to use the same library in an older version (compile 'com.android.support:appcompat-v7:25.3.1') could also be a problem.
And google moved it's repositories to a new location. When you use android gradle plugin > 3 just add this to your build-script
repositories {
google()
}
else add this
repositories {
maven {
url "https://maven.google.com"
}
}
Upvotes: 2