簡體   English   中英

無法將特定項添加到activity_main.xml

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM