簡體   English   中英

內部解析導致錯誤“無法解析符號 'okhttp3'”

[英]Parse internally causing error "Cannot resolve symbol 'okhttp3'"

我正在使用Parse Server開發一個 Android 應用程序。 我使用Parse Android SDK 中的文檔實現了基本要求。 但是 Parse SDK 在內部導致我收到以下錯誤:

Cannot resolve symbol 'okhttp3'
Cannot resolve symbol 'OkHttpClient

在此處輸入圖像描述

build.gradle(項目)文件如下所示:

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(模塊)文件如下所示:

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文件如下所示:

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

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

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

我怎么解決這個問題?

手動將存儲OkHttp的存儲庫之一( jcenter()mavenCentral()等)添加到文件build.gradle (項目)

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
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM