org.gradle.api.InvalidUserDataException: невозможно изменить стратегию конфигурации ': app: debugRuntimeClasspath' после того, как была устранена ошибка - PullRequest
1 голос
/ 03 апреля 2019

Недавно я долгое время обновлял Android Studio и сразу же столкнулся с множеством проблем при создании приложений, но большинство из них было решено, когда я перенес свой проект на androidX.

Но я не могу исправить эту ошибку в течение достаточно долгого времени. Я пытался ./gradlew cleanBuildCache это, но все с Gradle не удается для этого проекта.

В настоящее время я получаю это сообщение при попытке синхронизировать файлы Gradle.

Что пошло не так: Возникла проблема при настройке проекта «: приложение». org.gradle.api.InvalidUserDataException: невозможно изменить стратегию конфигурации ': app: debugRuntimeClasspath' после ее разрешения.

Когда я строю проект, я получаю эту ошибку:

Невозможно изменить стратегию конфигурации ': app: debugRuntimeClasspath' после ее разрешения.

Я не могу понять, что происходит и где.

Это моя сборка Gradle:

buildscript {

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


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.2.0'
}
}

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

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

Ниже приведено мое приложение Gradle:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'


buildscript {
repositories {
    maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-  plugin:0.11.2'
}
}

android {
signingConfigs {
    config {
        keyAlias 'key'
        keyPassword 'password1'
        storeFile file('location')
        storePassword 'password2'
    }
}
compileSdkVersion 28
defaultConfig {
    applicationId "com.app.myapp"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 5
    versionName "4.1"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    manifestPlaceholders = [
            onesignal_app_id               : 'id',
            // Project number pulled from dashboard, local value is ignored.
            onesignal_google_project_number: 'REMOTE'
    ]
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.github.Pradyuman7:ChocoBar:V1.0'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.onesignal:OneSignal:3.10.1'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha05'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
}

apply plugin: 'com.google.gms.google-services'

Буду признателен за любую помощь.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...