tim*_*imv 11 android gradle android-gradle-plugin
我有一个问题并且已经查看了可能的重复问题和答案,我认为这个问题没有得到其他人的回答.
我更新了我的播放服务以使用融合的位置提供程序,现在我的gradle中的appcompat显示错误.
所以我创建了一个新项目并检查了新项目的build.gradle并且具有完全相同的appcompat,但我的项目显示错误.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "au.com.itmobilesupport.sqltwo"
minSdkVersion 17
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'
}
}
}
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:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'
}
Run Code Online (Sandbox Code Playgroud)
它的这一行显示错误:
compile 'com.android.support:appcompat-v7:26.+'
Run Code Online (Sandbox Code Playgroud)
但在一个新项目中它很好.为什么我收到错误?
更新:
如果我删除这两行,则错误消失:
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'
Run Code Online (Sandbox Code Playgroud)
但我需要他们所以仍然有错误.
最后在ZeroOne对类似问题的回答的帮助下解决了这个问题.
让我看看ZeroOnes答案的原因是Google给了我原因但不是错误.我的问题是,以下行太过包含,并且添加了许多额外的依赖项,这会使应用程序不必要地变大.
compile 'com.google.android.gms:play-services:11.0.1'
Run Code Online (Sandbox Code Playgroud)
我只需要更具体,错误消失了.
这是最后的谜语.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "au.com.itmobilesupport.sqltwo"
minSdkVersion 17
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'
}
}
}
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:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
}
Run Code Online (Sandbox Code Playgroud)
这是我将以上内容更改为的具体行:
compile 'com.google.android.gms:play-services-location:11.0.1'
Run Code Online (Sandbox Code Playgroud)
希望它可以帮助遇到同样问题的人.
将这些行添加到您的build.gradle文件中,以获取您没有基于Google网站的库.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Run Code Online (Sandbox Code Playgroud)
警告:使用动态依赖项(例如,palette-v7:23.0.+)可能会导致意外的版本更新和回归不兼容.我们建议您明确指定库版本(例如,palette-v7:25.4.0).
| 归档时间: |
|
| 查看次数: |
27618 次 |
| 最近记录: |