0

I recently decided to learn Android programming, so I installed Android Studio and Android SDK on my Ubuntu machine. The issue is when I build a new project, it says :

Gradle Sync completed with some erros

and the log is :

/home/moein/apps/android-studio-projects/Testapp/app/build.gradle
    Error:Error:line (24)Failed to resolve: com.android.support:appcompat-v7:23.+
    Error:Error:line (23)Failed to resolve: junit:junit:4.12

my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.moein.testapp"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
}
moein rahimi
  • 774
  • 10
  • 20

5 Answers5

0

Do you have this in your build.gradle file:

compile 'com.android.support:appcompat-v7:23.3.0'
Nongthonbam Tonthoi
  • 12,667
  • 7
  • 37
  • 64
0

The most probable reason for such errors is you do not have all support libraries installed. Go to SDK manager and install all the supporting repositories. For more details you can visit this answer.

Community
  • 1
  • 1
Mohammed Atif
  • 4,383
  • 7
  • 28
  • 57
0

These are the correct version that you can add in your build.gradle according to the API needs.Use it by your requirement.

API 21:

compile 'com.android.support:appcompat-v7:21.0.1'

OR

compile 'com.android.support:appcompat-v7:21.0.2'

OR

compile 'com.android.support:appcompat-v7:21.0.3'

API 22:

compile 'com.android.support:appcompat-v7:22.0.0'   

API 23:

compile 'com.android.support:appcompat-v7:23.2.0'
0

Try Installing the following Highlighted item:

Support Library

Aamir
  • 286
  • 1
  • 2
  • 14
0

I found the answer to this problem.

I used to get it whenever I open a new project.

Just paste these lines in build.gradle (module:app)

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}

Sync it again it will probably solve your problem.

pringi
  • 3,987
  • 5
  • 35
  • 45