[英]Can't add any items to activity_main.xml in Android Studio
[英]Can't add specific items to activity_main.xml
Android新手在这里。 我不知道为什么,但我不能将特定的项目/元素添加到activity_main.xml(NestedScrollView,CardViev,Google MapView等)。 如果我尝试添加,请说Google MapView,会显示一条消息:
此操作需要库com.google.android.gms:play-services-maps:+。
问题:发现现有项目依赖项不一致。 版本不兼容: - com.google.android.material:material:1.0.0 and: - androidx.appcompat:appcompat:1.0.0
依赖: - org.mockito:mockito-core:1.9.5与: - org.mockito:mockito-core:2.19.0
添加此库后,项目可能无法编译。 你还想加它吗?
有谁知道这似乎是什么问题? Build.gradle显示如下。
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
你的第一个问题是你试图使用项目中不存在的库的视图,项目,常量等,这些实现对你来说绰绰有余,mockito的问题是那个您可能实现了两个版本,也许第一个版本使用已停产的组件,因此。 Gradle将始终寻找最新版本,但是两个库需要一起生活,我建议您删除mockito 1.9.5并尝试再次同步,我希望它有用,祝你好运!
apply plugin: 'com.google.gms.google-services' dependencies{ implementation 'com.google.android.gms:play-services-cast-framework:10.0.1' }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.