Home > Mobile >  Parse internally causing error "Cannot resolve symbol 'okhttp3'"
Parse internally causing error "Cannot resolve symbol 'okhttp3'"

Time:08-05

I am developing an Android application using the enter image description here

build.gradle (project) file looks like this:

plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
}

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

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

build.gradle (module) file looks like this:

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.sercan.parsetest"
        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
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation "com.github.parse-community.Parse-SDK-Android:parse:4.0.0"
    implementation "com.github.parse-community.Parse-SDK-Android:fcm:4.0.0"
}

settings.gradle file looks like this:

import org.gradle.api.initialization.resolve.RepositoriesMode

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

rootProject.name = "Parse Test"
include ':app'

How can I solve this problem?

CodePudding user response:

Manually add one of the repositories (jcenter(), mavenCentral(), etc.) where OkHttp is stored to file build.gradle (project):

plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
}

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

        /* The first option */
        jcenter()

        /* The second option */
        mavenCentral()
    }
}

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