首页 > 解决方案 > 无法解决:com.android.support 版本为 28

问题描述

下面我附上了我的代码,我收到了一些错误。使用 SDK 27 很好,但更改为 SDK 28,我收到错误消息。

谁能指出问题出在哪里以及如何解决?我已经为两者安装了 SDK,但仍然有错误。

我附上了2级文件。问题出在这里:

implementation 'com.android.support:appcompat-v7:28.0.0'

第一个 build.grade : -

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com."
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.layout_route_history.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    } }

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.5'
    implementation 'com.chaos.view:pinview:1.4.2'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-sdk-geojson:4.0.0'
    implementation('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.17.0') {
        transitive = true
    }
    implementation("com.mikepenz:materialdrawer:6.0.7@aar") {
        transitive = true
        exclude group: 'com.android.support'
    }
    implementation 'br.com.edsilfer:custom-searchable:0.1.0-Beta'
    implementation "com.squareup.picasso:picasso:2.71828"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.layout_route_history:runner:1.0.2'
    androidTestImplementation 'com.android.support.layout_route_history.espresso:espresso-core:3.0.2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' }

二年级档案:-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    } }

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }

    } }

task clean(type: Delete) {
    delete rootProject.buildDir }

标签: android

解决方案


你需要com.android.support.test改用com.android.support.layout_route_history.它的原因可能是你重命名了一些东西,工作室自动重命名了包或类似的东西。


推荐阅读