未找到与给定名称匹配的资源(位于';dialogCornerRadius';处,值为';?android:attr/dialogCornerRadius';)
有人能帮我解释一下为什么我在下面出现了错误吗 错误:(7,41)未找到与给定名称匹配的资源(位于 “dialogCornerRadius”的值为“?android:attr/dialogCornerRadius”)未找到与给定名称匹配的资源(位于';dialogCornerRadius';处,值为';?android:attr/dialogCornerRadius';),android,gradle,dependencies,build-error,Android,Gradle,Dependencies,Build Error,有人能帮我解释一下为什么我在下面出现了错误吗 错误:(7,41)未找到与给定名称匹配的资源(位于 “dialogCornerRadius”的值为“?android:attr/dialogCornerRadius”) 我通过选择 API 27+:Android API 27,p预览(预览) 在项目结构设置中。下图显示了我的设置。构建应用程序时出现的13个错误已经消失 将行compile'com.android.support:design:+'更改为compile'com.android.supp
我通过选择 API 27+:Android API 27,p预览(预览) 在项目结构设置中。下图显示了我的设置。构建应用程序时出现的13个错误已经消失
将行
compile'com.android.support:design:+'
更改为compile'com.android.support:design:26.+'
构建项目时,gradle依赖项正在下拉最新版本,因为+
告诉它“获取最新版本”。26.+
将告诉构建过程仅更新v26的最新版本
或者为了更加具体和安全,将行更改为特定版本,完全避免使用
+
。i、 e.编译com.android.support:design:27.1.0'
在大家的帮助下,我可以解决这个问题并在较低版本中运行应用程序
我更新的build.gradle如下所示
特别感谢所有的天才
apply plugin: 'com.android.application'
android.buildTypes.each { type ->
type.buildConfigField 'String', 'Base_URL', WEBServiceBaseURL
type.buildConfigField 'String', 'SMS_Base_URL', WEBServiceBaseSMSURL
}
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.dummy.dummy"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources 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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
忘记动态依赖项,用固定的特定版本替换它们: 错误:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:3.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
正确:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:3.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
更改gradle中的以下依赖项:
致:
致:
请注意,您可以指定任何版本,但请确保它们具有相同的版本
这将确保未创建
values-28.xml
文件。设置您的编译器DKVersion 28
让android studio下载平台文件如果在你的应用程序级别gradle中,如果你使用了compileSdkVersion=27,那么它将无法工作。 您必须使用版本28
编译DK28版
buildToolsVersion“28.0.3”
在迁移到AndroidX失败后,收到了相同的错误。
我恢复了Android Studio所做的所有更改,清理了项目,使缓存/重新启动无效,以及其他许多事情,但运气不好。
最后,我发现Android Studio在gradle.properties中添加了两行内容:
android.useAndroidX=true
android.enableJetifier=true
删除这些行后,一切恢复正常。我尝试了所有操作,但都无效。最后,在我将platforms/android/project.properties中的target改为28后,它终于成功了 改变
target=android-26
到
谢谢我注意到半小时前的一个相同错误。您最近更新过任何库版本吗?不,我没有更新任何东西!尝试将您的
buildToolsVersion
更改为26.0.2,直到出现相同的错误。@NileshRathod Well TIL。从未意识到这是一个P-特定的事情。Thanks@Jon,它没有给出任何错误。谢谢你的回答,但我无法在我的设备上运行,因为它提供minSdk(API 27,P预览)!=deviceSdk(API 24)知道可以做什么吗?@PavanPyati在build.gradle文件中有哪些值?编译dkversion'android-P'buildToolsVersion'26.0.2'@Jon是的,和你提到的一样。编译成功,但我无法在设备中安装此apk。我在安装apk时遇到的问题是:解析包时出现问题。此处相同-无法在设备上安装-失败[install_FAILED_OLDER_SDK:…需要开发平台P,但这是发布平台]我已完成更改。我使用CompileSDK版本作为android-P,buildToolVersion作为26。我成功构建,但未在设备中安装。如果我使用compileSdkVersion as 27,则其不起作用。@PepaHruška补充了关于如何使用特定版本号的说明。您应首先累积50个声誉。
'com.android.support:appcompat-v7:26.1.0'
android.useAndroidX=true
android.enableJetifier=true
target=android-26
target=android-28