简体   繁体   English

无法将特定项添加到activity_main.xml

[英]Can't add specific items to activity_main.xml

Android newbie here. Android新手在这里。 I don't know why but I can't add specific items/elements to the activity_main.xml (NestedScrollView, CardViev, Google MapView, etc). 我不知道为什么,但我不能将特定的项目/元素添加到activity_main.xml(NestedScrollView,CardViev,Google MapView等)。 If I try to add, let's say Google MapView, a message appears that says this : 如果我尝试添加,请说Google MapView,会显示一条消息:

This operation requires the library com.google.android.gms:play-services-maps:+. 此操作需要库com.google.android.gms:play-services-maps:+。

Problem: Inconsistencies in the existing project dependencies found. 问题:发现现有项目依赖项不一致。 Version incompatibility between: - com.google.android.material:material:1.0.0 and: - androidx.appcompat:appcompat:1.0.0 版本不兼容: - com.google.android.material:material:1.0.0 and: - androidx.appcompat:appcompat:1.0.0

With the dependency: - org.mockito:mockito-core:1.9.5 versus: - org.mockito:mockito-core:2.19.0 依赖: - org.mockito:mockito-core:1.9.5与: - org.mockito:mockito-core:2.19.0

The project may not compile after adding this library. 添加此库后,项目可能无法编译。 Would you like to add it anyway?. 你还想加它吗?

Does anybody know what seems to be the problem? 有谁知道这似乎是什么问题? Build.gradle is displayed below. 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'
}

The first of your problems is that you try to use Views, items, constants, etc, of a library that does not exist in your project, with these implementations it is more than enough for you to move forward, the problem with mockito is that you possibly implemented two versions and maybe the first version uses discontinued components, and therefore. 你的第一个问题是你试图使用项目中不存在的库的视图,项目,常量等,这些实现对你来说绰绰有余,mockito的问题是那个您可能实现了两个版本,也许第一个版本使用已停产的组件,因此。 Gradle will always look for the latest version, however both libraries need to live together, I recommend that you remove mockito 1.9.5 and try to synchronize again, I hope it was helpful , good luck! 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM