Gun*_*arK 59 android gradle android-support-library build.gradle android-8.0-oreo
由于我已将Nexus 5x升级到Android O DP3,因此无法测试我的应用程序.我收到错误,因为我没有配置我的Gradle文件来使用新的API级别(26).
所以我改变了这个和依赖项,但是我的所有支持库都出现了错误
Failed to resolve: com.android.support:design:26.0.0-beta2
Run Code Online (Sandbox Code Playgroud)
点击
Install repository and sync project
Run Code Online (Sandbox Code Playgroud)
弹出progressdialog以下载正确的依赖项,但不会删除错误.清理项目,安装存储库然后重建项目也不起作用.
在appcompat-v7:26.0.0-beta2上,我得到(甚至在Gradle同步之前)带有错误的线条:
When using a compileSdkVersion older than android-O revision 2,
the support library version must be 26.0.0-alpha1 or lower (was 26.0.0-beta2)
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我为Android API 26正确配置gradle文件吗?任何帮助,将不胜感激.
PS:我现在正在使用Gradle 3.0.0-alpha3,但在Gradle 2.3.2上得到了同样的错误
我的Gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "********"
minSdkVersion 21
targetSdkVersion 26
versionCode 3
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
compile 'com.android.support:design:26.0.0-beta2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:26.0.0-beta2'
compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
compile 'com.redbooth:WelcomeCoordinator:1.0.1'
compile 'com.github.kittinunf.fuel:fuel-android:1.4.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.ramotion.foldingcell:folding-cell:1.1.0'
}
Run Code Online (Sandbox Code Playgroud)
I.G*_*ual 130
你添加了谷歌maven端点吗?
重要提示:现在可以通过Google的Maven存储库获得支持库.您无需从SDK Manager下载支持存储库.有关更多信息,请参阅支持库设置.
将端点添加到build.gradle文件中:
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
Run Code Online (Sandbox Code Playgroud)
google()
从Android Gradle v3开始,可以用快捷方式替换:
allprojects {
repositories {
jcenter()
google()
}
}
Run Code Online (Sandbox Code Playgroud)
如果你已经在里面有任何maven url repositories
,你可以在它们之后添加引用,即:
allprojects {
repositories {
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
}
Run Code Online (Sandbox Code Playgroud)
Kes*_*era 14
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.keshav.retroft2arrayinsidearrayexamplekeshav"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
Run Code Online (Sandbox Code Playgroud)
从设置maven源URL到gradle,我建议添加设计和appcompat库.目前最新版本为26.1.0
maven {
url "https://maven.google.com"
}
Run Code Online (Sandbox Code Playgroud)
...
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
Run Code Online (Sandbox Code Playgroud)
您可以添加google()
到存储库块
allprojects {
repositories {
jcenter()
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
maven {
url "https://jitpack.io"
}
google()
}
}
Run Code Online (Sandbox Code Playgroud)
您必须在MODULE-LEVEL build.gradle文件中添加:
//module-level build.gradle file
repositories {
maven {
url 'https://maven.google.com'
}
}
Run Code Online (Sandbox Code Playgroud)
请参阅:Google的Maven存储库
我观察到,当我使用Android 2.3.3工作室我必须添加库{{行家URL" https://maven.google.com "}}在模块级的build.gradle.对于Android Studio 3.0.0,不需要在模块级build.gradle中添加.在项目级 build.gradle中添加就足够了,这在其他帖子中已经引用,即:
//project-level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
Run Code Online (Sandbox Code Playgroud)
更新11-14-2017:我提出的解决方案在我发布时有效.从那以后,有各种更新(即使我参考的网站),我不知道现在是否有效.有一个月我根据上面的解决方案完成了我的工作,直到我升级到Android Studio 3.0.0
归档时间: |
|
查看次数: |
104165 次 |
最近记录: |