未解决的参考“设计”

时间:2019-03-16 04:13:00

标签: android android-gradle

将gradle升级到4.0后,我的代码卡住了以下消息。

org.gradle.api.GradleException: Compilation error. See log for more details
    at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:14)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:135)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:152)
    at ...
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)

我正在使用 Android Studio 3.3.2,buildToolsVersion为28.0.3

我仍在尝试使用Google搜索来解决它,但没有任何进展。我不明白为什么android.support.design无法解决。

您能给我一些解决方法的提示吗?

enter image description here

添加build.gralde(项目)

buildscript {
     ext.kotlin_version = '1.3.21'

     repositories {
         jcenter()
         google()
         maven {
             url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
         }
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.3.1'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
         classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
         classpath 'com.google.gms:google-services:4.0.1'
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }
 allprojects {
     repositories {
         jcenter()
         google()
     } }

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

添加build.gralde(模块)

apply plugin: 'com.android.application' apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions' apply plugin:
 'com.google.gms.google-services'

 android {
     compileSdkVersion 23
     buildToolsVersion '28.0.3'
     defaultConfig {
         applicationId "io.fogcloud.demo"
         minSdkVersion 16
         targetSdkVersion 23
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
     lintOptions {
         abortOnError false
     }
     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
     compileOptions {
         sourceCompatibility = '1.8'
         targetCompatibility = '1.8'
     } }

 dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
     testImplementation 'junit:junit:4.12'
     implementation 'com.android.support:appcompat-v7:23.4.0'
     implementation 'com.android.support.constraint:constraint-layout:1.0.1'
     implementation 'io.fogcloud.sdk:easylinkv3:0.2.7'
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
 repositories {
     mavenCentral() }

2 个答案:

答案 0 :(得分:1)

尝试进行以下更改

添加build.gralde(项目)

buildscript {
     ext.kotlin_version = '1.3.21'

     repositories {
         google()
         jcenter()

         maven {
             url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
         }
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.3.1'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
         classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
         classpath 'com.google.gms:google-services:4.0.1'
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }
 allprojects {
     repositories {
         google()
         jcenter()

     } }

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

现在在您添加的build.gralde(模块)中添加dependencies implementation 'com.android.support:design:23.4.0'

答案 1 :(得分:1)

将gradle更改为4.10.1 android studio->文件->项目结构->项目-> Gradle版本