javaandroidgradleparse-platformparse-android-sdk

Parse internally causing error "Cannot resolve symbol 'okhttp3'"


I am developing an Android application using the Parse Server. I implemented the basic requirements using the documentation from the Parse Android SDK. But the Parse SDK internally causes me to get the following errors:

Cannot resolve symbol 'okhttp3'
Cannot resolve symbol 'OkHttpClient

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?


Solution

  • 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
    }