Android gradle sync问题

时间:2017-12-05 23:41:28

标签: android gradle

此应用程序运行完全正常,没有任何问题。突然间,我看到了这个同步问题。我真的卡住了,需要帮助。现在做什么?我从SDK管理器中卸载并重新安装了android支持存储库。

C:\Users\DELL\AndroidStudioProjects\Prokriti\app\build.gradle
    Error:Error:Failed to resolve: com.android.support:support-annotations:27.0.1
Install Repository and sync project
    Error:Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Install Repository and sync project
    Error:Error:Failed to resolve: com.android.support:customtabs:27.0.1
Install Repository and sync project
    Error:Error:Failed to resolve: com.android.support:cardview-v7:27.0.1
Install Repository and sync project
    Error:Error:Failed to resolve: com.android.support:support-v4:27.0.1
Install Repository and sync project
    Error:Error:Failed to resolve: com.android.support:support-core-utils:27.0.1
Install Repository and sync project

build.gradle(app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.avtro.prokriti.prokriti"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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


    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-core-utils:25.3.1'
    compile 'com.android.support:support-annotations:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.android.gms:play-services-auth:11.0.4'
    compile 'com.google.firebase:firebase-core:11.0.2'
    compile 'com.google.firebase:firebase-messaging:11.0.2'
    compile 'com.google.firebase:firebase-database:11.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-ads:11.0.2'
    compile 'com.afollestad.material-dialogs:core:0.9.4.5'
    compile 'com.wang.avi:library:2.1.3'
    compile 'com.google.android.gms:play-services-ads:11.0.4'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.survivingwithandroid:weatherlib:1.6.0'
    compile 'com.amitshekhar.android:android-networking:1.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.okhttp:okhttp:2.0.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.google.firebase:firebase-storage:11.0.2'
    androidTestCompile 'junit:junit:4.12'
    compile 'javax.inject:javax.inject:1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.github.bumptech.glide:glide:3.8.0'
}
apply plugin: 'com.google.gms.google-services'

build.gradle(项目)

buildscript {
    repositories {
        jcenter()
    }
dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

我没有更新android studio或gradle。已安装Android支持存储库。

9 个答案:

答案 0 :(得分:39)

我通过删除

来解决问题
 compile 'com.facebook.android:facebook-android-sdk:[4,5)'

并添加

compile 'com.facebook.android:facebook-android-sdk:4.26.0'

答案 1 :(得分:9)

您只需更改一行。

通过更新 facebook sdk 版本

进行修复


compile' com.facebook.android:facebook-android-sdk:[4,5)'

编译' com.facebook.android:facebook-android-sdk:4.26.0'

答案 2 :(得分:7)

enter image description here

<强> 'com.facebook.android:facebook-android-sdk:4,5)'

<强> 'com.facebook.android:facebook-android-sdk:4。+'

以上替换以下

<强> 'com.facebook.android:facebook-android-sdk:4.26.0'

答案 3 :(得分:1)

替换

A <- matrix(1:16, 4, 4, byrow=TRUE)

通过

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

希望它能运作

答案 4 :(得分:0)

google()buildscript.repositories中添加allprojects.repositories

buildscript {
    repositories {
        google()
        jcenter()
    }
dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

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

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

这可以解决您的问题。

答案 5 :(得分:0)

// For increasing horizontal space
var width = 600;

// For arranging chart in full space
var svg = d3.select('#chart')
      .append('svg')
      .attr('width', width)
      .attr('height', height)
      .append('g')
      .attr('transform', 'translate(' + (width / 4) + 
        ',' + (height / 2) + ')');

// For moving legend to right
var legend = svg.selectAll('.legend')
  .data(color.domain())
  .enter()
  .append('g')
  .attr('class', 'legend')
  .attr('transform', function(d, i) {
     var height = legendRectSize + legendSpacing;
     var offset =  height * color.domain().length / 2;
     var horz = 7 * legendRectSize;

答案 6 :(得分:0)

使用此

SELECT * 
FROM Table1 
WHERE flag1 = 0  
JOIN SELECT * 
     FROM TABLE2 
     where flag2 = 0 on Table1.email = TABLE2.email

答案 7 :(得分:0)

对于本地反应项目:将maven repo添加到项目中。 (添加maven repo链接后删除react-native-fbsdk错误。)

buildscript {
    repositories {
       jcenter()
       mavenCentral()
       maven {            // Add this block
          url "https://maven.google.com"
       }
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

        // If something is not found from above maven repo.
        maven { url 'https://maven.google.com' }    // Add this block 
    }
}

更多信息here

答案 8 :(得分:0)

<强>不

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

根据Facebook SDK for Android,您应该使用

 // Facebook Android SDK (everything)
  compile 'com.facebook.android:facebook-android-sdk:4.+'

更新案例阅读Changelog and release notes for the Facebook SDK for Android.

compile 'com.facebook.android:facebook-android-sdk:4.26.0'
compile 'com.facebook.android:facebook-android-sdk:4.27.0'
compile 'com.facebook.android:facebook-android-sdk:4.28.0'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'