Home > OS >  Android studio arctic fox gradle error whene add repositories
Android studio arctic fox gradle error whene add repositories

Time:09-22

I'm on the last version of android studio and gradle. I wanted to use Liquid swipe animation in my project (i used it before in other project). In this version in the build.gradle there no allprojects{repositories.{..}} any more i dont know why. When i added manually and i past the code mentioned in the readme file i got an error :

A problem occurred evaluating project 'MyApp'.

Build was configured to prefer settings repositories over project repositories but repository 'GitHubPackages' was added by build file 'app\build.gradle'

Can any one help me please

CodePudding user response:

I had the same problem adding a different library recently.
It appears that repositories now need to be added in gradle.settings file and not in build.gradle.

Just put it in a repositories block there as usual, or create one if needed.

Adding implementation line still works the same.

CodePudding user response:

Let me share my project buld.gradle code:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

make shure that all urls have https at start, not http. If you use this liquid swipe animation library - https://github.com/Cuberto/liquid-swipe-android all you need is to add this line - implementation 'com.cuberto:liquid-swipe:1.0.0' line to your APP build.gradle dependencies not to PROJECT one

  • Related