0

I tried to download a library. But I think i did something wrong in my build.gradle Project. Because when I try to import the library manually, I get this error:

My Project Gradle File

buildscript {
    repositories {
        google()
        maven {url 'https://jitpack.io'}
    }
    dependencies {
        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3")
    }
}

plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}

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

My App Gradle File

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'androidx.navigation.safeargs.kotlin'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.ahmetkaan.kediy"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        viewBinding true
    }
}

dependencies {
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

    //...

    implementation 'com.github.onecode369:WYSIWYG:4.0'
}

The library says me to add " maven {url 'https://jitpack.io'} " this to my project gradle and " implementation 'com.github.onecode369:WYSIWYG:4.0' " this to my app gradle. I think there is a problem in the project gradle's repositories (maven). Because the library says to me add like this;

allprojects {
    repositories {
        ...
        maven {url 'https://jitpack.io' }
    }
}

But I can't add allprojects on top of repositories. I am getting an error like:

A problem occurred evaluating root project 'Kediy'.
> Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'

What should I do?

Lino
  • 5,084
  • 3
  • 21
  • 39
Ahmet Kaan
  • 27
  • 5
  • I googled that error message and found a similar StackOverflow question. Does this help? https://stackoverflow.com/questions/69163511/build-was-configured-to-prefer-settings-repositories-over-project-repositories-b – dnault Feb 17 '23 at 18:03
  • I tried but doesnt work – Ahmet Kaan Feb 18 '23 at 16:41
  • By the way My Android Gradle Plugin Version is '7.2.1' and Gradle Version is '7.3.3' is it matter? – Ahmet Kaan Feb 18 '23 at 16:46
  • Guys... I just forgot to turn on the internet... so I couldn't reach the library, rightly so... – Ahmet Kaan Feb 21 '23 at 16:58

0 Answers0