Android Studio 3.1 Canary 3上的Gradle同步错误

rt

嘿,将Android Studio更新到3.1 Canary 3之后,我刚刚创建了一个新项目,但是gradle同步失败,原因是:

错误:com.android.tools.idea.gradle.project.model.AndroidModuleModel.getMainArtifact()Lcom / android / tools / idea / gradle / project / model / ide / android / IdeAndroidArtifact; com.android.tools.idea.gradle .project.model.AndroidModuleModel.getMainArtifact()Lcom / android / tools / idea / gradle / project / model / ide / android / IdeAndroidArtifact;

我的gradle文件是:

> buildscript {
>     ext.kotlin_version = '1.2.0-rc-39'
>     repositories {
>         google()
>         jcenter()
>         maven { url "https://dl.bintray.com/kotlin/kotlin-dev"}
>     }
>     dependencies {
>         classpath 'com.android.tools.build:gradle:3.1.0-alpha03'
>         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
>         classpath 'com.google.gms:google-services:3.1.0'
>     } }
> 
> allprojects {
>     repositories {
>         google()
>         jcenter()
>         maven { url "https://dl.bintray.com/kotlin/kotlin-dev"}
>     } }
> 
> task clean(type: Delete) {
>     delete rootProject.buildDir }
> 

还有第二个build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {

    compileSdkVersion 27
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "xxx"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "0.0.1"
        setProperty("archivesBaseName", "xxx v$versionName")
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

        buildConfigField 'String', 'apiEndpointUrl', '"https://xxx.xxx.xxx"'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

ext {
    supportLibrary = '26.1.0'
    playServices = '11.2.2'
    androidLifecycle = '1.0.0-alpha9'
    androidLifecycleCompiler = '1.0.0-alpha8'
    jackson = '2.9.0'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    // RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0'

    // Retrofit
    implementation 'com.squareup.okhttp3:okhttp:3.8.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'

    implementation 'com.squareup.retrofit2:converter-jackson:2.3.0'
    implementation "com.fasterxml.jackson.core:jackson-core:${jackson}"
    implementation "com.fasterxml.jackson.core:jackson-annotations:${jackson}"
    implementation "com.fasterxml.jackson.core:jackson-databind:${jackson}"

    // Google Play / Firebase services
    implementation 'com.google.android.gms:play-services-maps:11.6.0'

    // Widgets / Views
    implementation "com.android.support:appcompat-v7:$supportLibrary"
    implementation "com.android.support:design:${supportLibrary}"
    implementation "com.android.support:support-v4:${supportLibrary}"
    implementation "com.android.support:cardview-v7:${supportLibrary}"
    implementation "com.android.support:recyclerview-v7:${supportLibrary}"
    implementation "com.android.support:support-vector-drawable:${supportLibrary}"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    // EventBus
    implementation 'org.greenrobot:eventbus:3.0.0'

    //    Android Architecture
    implementation "android.arch.lifecycle:runtime:${androidLifecycle}"
    implementation "android.arch.lifecycle:extensions:${androidLifecycle}"
    annotationProcessor "android.arch.lifecycle:compiler:${androidLifecycleCompiler}"
    kapt "android.arch.lifecycle:compiler:${androidLifecycleCompiler}"

    // Room - DB ORM
    implementation "android.arch.persistence.room:runtime:$androidLifecycle"
    implementation "android.arch.persistence.room:rxjava2:${androidLifecycle}"
    annotationProcessor "android.arch.persistence.room:compiler:${androidLifecycleCompiler}"
    kapt "android.arch.persistence.room:compiler:${androidLifecycleCompiler}"
}
哈利248

这里同样的问题。卸载Kotlin插件(“首选项”>“插件”>“ Kotlin”>“卸载”)并使用IDE随附的版本可以解决我的问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Android Studio 3.0 Canary 1:Gradle同步错误

Android Studio 3.1 Canary 3 - Gradle 项目同步失败

Android Studio 3.1 Canary 3-Gradle同步失败

使用Android Studio 3 Canary 1的app:transformClassesWithDesugarForMockDebug

flavourDimensions gradle错误-Android Studio 3.0 Canary 1

Android Studio 3.4 Canary 3 编译错误

Android Studio 3.0 Canary 1注解处理器错误

Android Studio 3.0 canary 1:SQL 语法错误

使用Android Studio 3.0 Canary 3进行数据绑定

Android Studio 3.0 Canary 3中的org.gradle.tooling.BuildException

更新到Android Studio 2.3 Canary 3后,Gradle构建失败

Android Studio 3.0 Canary 5中的Gradle同步失败

Android Studio 3中的同步项目时出现Gradle错误

Android Studio 3.0 Canary 4构建错误

Android Studio 3.0 Canary 2 更新错误

Android Studio Canary 5更新错误

更新到 android studio preview 3.0 canary 3 后无法构建项目

Android Studio 3.0 Canary 1:项目刷新失败

无法在Android Studio 3.0 Canary 1下编译

Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variant.getApplicationId()

Android Studio 3.6 Canary 4-Gradle引发DefaultProjectSyncIssues异常

Android Studio 3.6 Canary 4-Gradle引发DefaultProjectSyncIssues异常

从Android Studio'3.2 Canary 16'升级到'3.2 Beta 1'后,数据绑定编译错误

Android Studio 3创建新项目错误。Gradle同步失败,无法解决依赖性

Android Studio-gradle-diagnostics-XXXjar上的Gradle同步错误

Android Studio 3.0 Canary 1 - 模拟器在启动时卡住

Android Studio 4.1 Canary 1未显示Layout Inspector Live更新

Android Studio上的setEGLContextClientVersion(3)导致错误

如何安装Android Studio 3.5 Canary 12?