【问题标题】:SDK version rendering problemsSDK版本渲染问题
【发布时间】:2018-08-03 19:30:35
【问题描述】:

最近我将我的 android studio SDK 版本 API level 23 更新为 26。现在我的旧项目出现问题。我该如何解决这个问题?

错误是:无法加载 LayoutLib: com/android/layoutlib/bridge/Bridge:不支持的major.minor版本 52.0(详情)

而我的 build.gradle 错误是:

build.gradle screenshoot

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "..."
        minSdkVersion 26
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
}

enter image description here

【问题讨论】:

  • 我想是因为你compileSdkVersion小于targetSdkVersion他需要一样。
  • 你的 minSdkVersion 26 和 compileSdkVersion 是 23,你只是想它会如何工作?
  • targetSdkVersion更改为23或将compileSdkVersion更改为26并删除buildToolsVerison或将其更改为26.X.X
  • 哦,抱歉……我没看到。谢谢

标签: android gradle sdk android-gradle-plugin


【解决方案1】:

如下尝试

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.1.0"
    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
}

【讨论】:

  • 错误:找不到构建工具修订版 26.1.0 安装构建工具 26.1.0 并同步项目
  • 然后安装它们
猜你喜欢
  • 1970-01-01
  • 2015-05-14
  • 1970-01-01
  • 2018-08-15
  • 2010-09-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多