【发布时间】:2018-04-12 01:21:24
【问题描述】:
之前一切都很好,但现在当我重新打开我的 Android 项目时,在样式中的 values 文件夹中,大部分父项都以红色突出显示。我不明白为什么以及如何解决它。当我编译项目时它工作正常,但我只想删除错误。以下是错误文件
这是图片文件:
我的应用构建文件是
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
useLibrary 'org.apache.http.legacy'
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.nepalpolice.cdp"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 26
versionCode 15
versionName "15.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/project.properties'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'allclasses-frame.html'
}
}
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation("com.github.bumptech.glide:glide:4.6.1") {
exclude group: "com.android.support"
}
compile 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
implementation 'com.android.support:support-v4:26.+'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.+'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.gms:google-services:3.1.0'
implementation 'com.android.support:design:26.+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:multidex:1.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
implementation 'com.android.support:gridlayout-v7:26.+'
implementation 'com.github.clans:fab:1.6.2'
testCompile 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.firebase:firebase-firestore:11.4.2'
implementation 'id.zelory:compressor:2.1.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
implementation files('libs/libGoogleAnalyticsServices.jar')
apply plugin: 'com.google.gms.google-services'
}
而我的构建 gradle 文件是
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
useLibrary 'org.apache.http.legacy'
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.nepalpolice.cdp"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 26
versionCode 15
versionName "15.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/project.properties'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'allclasses-frame.html'
}
}
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation("com.github.bumptech.glide:glide:4.6.1") {
exclude group: "com.android.support"
}
compile 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
implementation 'com.android.support:support-v4:26.+'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.+'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.gms:google-services:3.1.0'
implementation 'com.android.support:design:26.+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:multidex:1.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
implementation 'com.android.support:gridlayout-v7:26.+'
implementation 'com.github.clans:fab:1.6.2'
testCompile 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.firebase:firebase-firestore:11.4.2'
implementation 'id.zelory:compressor:2.1.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
implementation files('libs/libGoogleAnalyticsServices.jar')
apply plugin: 'com.google.gms.google-services'
}
我尝试清理并运行项目,但问题仍未解决。
【问题讨论】:
-
是的,关于它说 3.1 的部分
-
@MikeM。这似乎解决了问题,但只有当我将 compiledSDKversion 替换为 27 而不是 26 时。但我仍然有 targetSDK 版本为 26。我是否也应该将其更改为 27?会不会有什么问题?
-
一般情况下是
'com.android.support:support-v4:26.+'指定版本的原因? (大多数人不建议使用'+')'com.android.support:support-v4:26.1.0'还有'com.android.support:design-v4:26.1.0'
标签: java android android-gradle-plugin