这个应用程序运行完全正常没有任何问题。突然间,我看到了这个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支持存储库。
我通过删除来解决问题
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
并添加
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
您只需要更改一行。
通过更新facebook sdk版本修复
从 编译'com.facebook.android:facebook-android-sdk:[4,5)'到
编译'com.facebook.android:facebook-android-sdk:4.26.0'
更换
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
通过
compile 'com.facebook.android:facebook-android-sdk:4.26.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
}
这应该可以解决您的问题。
Its work for me
Its work for me
Update Android SDK Build -Tools and SDK platforms
Changed in project build file.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
changed in app build file
compileSdkVersion 26
buildToolsVersion "26.0.2"
Disable dependencies inspection.
compile 'com.android.support:design:25.3.1
用这个
repositories {
maven { url 'https://maven.google.com/' }
}
对于本机反应项目:将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
别
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'