1

I am getting the following error in the Android Studio when "Gradle sync" is on action:
Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.30/kotlin-stdlib-jdk8-1.4.30.pom'. Received status code 403 from server: Forbidden Disable Gradle 'offline mode' and sync project
It downloads few files then stuck on the same filekotlin-stdlib-jdk8-1.4.30.pom and show the error above.
I have tried several solutions like here and here and none of them realy solve the problem.
And since I am only using Java why the Android studio should care about kotlin ,is there any thing i can do to avoid dealing with Kotlin?
this is the gradle>build.gradle file:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        //classpath "com.android.tools.build:gradle:4.1.3"
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:4.2.0'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

and this is the app>src>build.gradle file:

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.myapplication_10"
        minSdkVersion 29
        targetSdkVersion 29
        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 {

    classpath 'com.android.tools.build:gradle:+'
    classpath 'com.google.gms:google-services:4.2.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
SolidSnake
  • 41
  • 1
  • 7

1 Answers1

2

403 Forbidden usually means you're connecting from a country under US sanctions (Iran for example). Try to clean project, clear Gradle cache, quit android studio, connect to a VPN to change the IP of your computer, open studio and sync/run. Also some services like Shecan or Begzar might help.

Amin
  • 3,056
  • 4
  • 23
  • 34
  • I cleaned my project using "gradlew cleanBuildCache" then restart and unfortunately nothing change. I am using Psiphon should I use something else or maybe try specific connection setting ? – SolidSnake Mar 24 '21 at 20:58
  • I haven't used Psiphon in years so I've got no idea about it. But try Shecan it used to work. Also if you have some knowledge about vpn servers, it worth getting a VPS outside your country and install Shadowsocks/OpenVPN on it and use that VPN for yourself :D – Amin Mar 24 '21 at 21:21
  • I moved to Proton VPN and the error is gone! ,thank you – SolidSnake Mar 25 '21 at 08:23