web-dev-qa-db-fra.com

Erreur de synchronisation sur Android Studio 3.1 Canary 3

Salut les boursiers après la mise à jour d'Android Studio vers 3.1 Canary 3 Je viens de créer un nouveau projet, mais la synchronisation des graduations a échoué à cause de:

Erreur: com.Android.tools.idea.gradle.project.model.AndroidModuleModel.getMainArtifact () Lcom/Android/outils/idée/grade/projet/modèle/Android/IdeAndroidArtifact; com.Android.tools.idea.grad .project.model.AndroidModuleModel.getMainArtifact () Lcom/Android/outils/idea/gradle/projet/modèle/ide/Android/IdeAndroidArtifact;

Mon fichier de classement est:

> 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 }
> 

Et le second 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}"
}
16
murt

Même problème ici. La désinstallation du plug-in Kotlin (Préférences> Plug-ins> Kotlin> Désinstaller) et l'utilisation de la version fournie avec IDE ont résolu le problème pour moi.

38
harry248

ouvrez la boîte de dialogue des paramètres, puis sélectionnez les plugins et recherchez Kotlin & désinstallez-le, redémarrez Android Studio et mettez à niveau le Gradle si vous y êtes invité.

1
Fanadez