这个问题在这里已有答案:
有人可以帮助我解决这个错误。首先,我遇到了设计XML文件的问题。我没有进一步为我的android studio version3.0.1创建一个练习项目。面对这个问题所以guyz帮助我完全解决方案
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rahul.expensemanager"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "27.+"
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-ads:15.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
implementation 'com.android.support:support-annotations:28.0.0-rc02'
implementation 'com.android.support:design:28.0.0-rc02' implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-rc02'
// implementation "com.google.firebase:firebase-client-android:3.4.0"
}
apply plugin: 'com.google.gms.google-services'
我在实现中看到您混合了支持库版本。不要那样做。这将导致错误。始终为支持库使用一个特定版本。混合会导致错误。试试这个:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rahul.expensemanager"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "28.0.0-alpha1"
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-ads:15.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support:support-annotations:28.0.0-alpha1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
implementation 'com.android.support:support-annotations:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
// implementation "com.google.firebase:firebase-client-android:3.4.0"
}
apply plugin: 'com.google.gms.google-services'
我所做的是使用你的项目的28.0.0-alpha1
版本。告诉我错误是否仍然存在。
似乎错误来自sdk 28 ..我建议你在app level gradle文件中更改sdk版本。
将所有依赖项更改为sdk 27
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
至
implementation 'com.android.support:appcompat-v7:27.1.1'
要么
implementation 'com.android.support:appcompat-v7:21.1.0'
像这样改变你找到的每个依赖项
28.0.0-alpha1
进入这些sdk版本,然后检查,希望它会帮助你。
and also change the sdk version to 28 to 27