Выпуск приложения React-Native для Android: не удалось найти com.android.support:multidex-instrumentation:27.1.1 - PullRequest
0 голосов
/ 12 февраля 2019

Когда я ./gradlew assembleRelease мое родное приложение React, я получаю:

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not find com.android.support:multidex-instrumentation:27.1.1.

Что нужно изменить, чтобы сделать его правильным?

Мой build.graddle:

android {
    defaultConfig {
        // ...
        multiDexEnabled true // if I comment it, I run into the multidex needed error : The number of method references in a .dex file cannot exceed 64K.
    }
}
dependencies {
    // ...
    implementation 'com.android.support:multidex:1.0.3' // commenting it does not change the problem
}

1 Ответ

0 голосов
/ 29 марта 2019

Если вы использовали react-native-navigation, то в вашем app / build.gradle :

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support' && requested.name != 'multidex') {
            details.useVersion "${rootProject.ext.supportLibVersion}"
        }
    }
}

есть что-то подобное, не забудьте также о библиотеках, которые вызывают проблемы.в состоянии выше.Вот так:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support' 
            && requested.name != 'multidex' 
            && requested.name != 'multidex-instrumentation') {
            details.useVersion "${rootProject.ext.supportLibVersion}"
        }
    }
}
...