2

I have an android project that I developed it using android studio 2.3 after that I update the android studio to 3.3 and open the this project with new version but got many errors solve a lot of them but have new errors so this is my app build.gradle:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        buildToolsVersion "27.0.3"
        defaultConfig {
            applicationId ""
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            aaptOptions {
                cruncherEnabled = false
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })

        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.android.support:cardview-v7:26.1.0'
        implementation 'com.android.support:recyclerview-v7:26.1.0'
        implementation 'com.squareup.picasso:picasso:2.5.2'
        implementation 'com.jakewharton:butterknife:8.8.1'
        implementation 'com.roughike:bottom-bar:2.0.2'
        implementation 'com.android.support:palette-v7:26.1.0'
        implementation 'com.android.support:support-v4:26.1.0'
        implementation 'com.google.android.exoplayer:exoplayer:r2.3.1'
        testImplementation 'junit:junit:4.12'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
        implementation 'com.android.support:support-core-utils:26.1.0'
    }

and this is my project build.gradle:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
}

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

and this is my gradle-wrapper-properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

and this is the errors I get:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:cardview-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:recyclerview-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.roughike:bottom-bar:2.0.2.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:palette-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:support-v4:26.1.0.
Open File
Show Details

............ etc.

I'm trying to change the 26.0.1 for all dependencies and target sdk from 26 to 27 and 27.1.1 and I got the same errors

I already use proxy so this is my gradle.properties:

systemProp.http.proxyHost=ip
systemProp.http.proxyPort=port
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=pass

systemProp.https.proxyHost=ip
systemProp.https.proxyPort=port
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=pass

and st it from setting > HTTP proxy by use the manual proxy configuration

and when I add the google() to gradle the errors changed to :

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.android.support:support-core-utils:27.1.1
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.1.1/support-core-utils-27.1.1.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.1.1/support-core-utils-27.1.1.aar'. Received status code 407 from server: Proxy Authentication Required

so I just delete google() what's the problem?

muklah
  • 855
  • 2
  • 11
  • 19

1 Answers1

2

You haven't included google() repository in root build.gradle.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
}



task clean(type: Delete) {
    delete rootProject.buildDir
}
NightFury
  • 13,436
  • 6
  • 71
  • 120
  • I already tried that but I read in some answers at stackover flow that I should use google() when I use gradle more than 4 and use maven { url "https://maven.google.com if the gradle is less than that so as I told I already tried that but I was got errors to that's led me to delete google(), I edit the question and add the errors that appear with google() so please see it – muklah Jul 22 '18 at 18:09
  • 1. check if your gradle is not compiling offline. 2. Since you are using proxy, most probably it is unable to connect. So you need to reconfigure. Check last comment [here](https://discuss.gradle.org/t/how-to-resolve-407-proxy-issue/11365/8). Also make sure you have configured proxy settings in File > Settings > Search Proxy> Auto-detect Proxy settings @muklah – NightFury Jul 22 '18 at 18:26
  • it is not compiling offline mode and I check the last comment and do like he said then I check the Auto-detect Proxy settings but it ask for automatic proxy configuration URL so what should I put in it the ip or what? – muklah Jul 22 '18 at 18:42
  • @muklah There are two options available for you there. Either enter URL for auto detection of proxy settings. OR do manual configuration. I think you should know config for manual config atleast ? – NightFury Jul 22 '18 at 20:27
  • For gradle proxy configurations, you need to configure multiple places, check more details from this thread https://stackoverflow.com/questions/44976794/gradle-build-is-hanging-without-failure-defaultfilelockmanager-acquiring-and-re/51128852#51128852 – shizhen Jul 23 '18 at 02:42