android - 无法解析 : multidex-instrumentation

标签 android maven android-studio gradle android-multidex

在实现 multidex 时,每当我同步我的项目时都会遇到以下错误。

Failed to resolve: multidex-instrumentation

I used these instructions to set it up.

这里是相关的应用级build.gradle:

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "xxx.xyz.zzz"
        minSdkVersion 16
        targetSdkVersion 22
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}
dependencies {
    compile 'com.android.support:multidex:1.0.3'
    ....and the rest
}

以及相关的项目级build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.1.2'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

我在这里错过了什么?

最佳答案

在您的 gradle 文件中添加以下依赖项并检查。我遇到了同样的问题,通过添加它解决了这个问题。

androidTestImplementation 'com.android.support:multidex-instrumentation:1.0.3'

关于android - 无法解析 : multidex-instrumentation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53001329/

相关文章:

android - 如何在多行 TextInputLayout 中将 EndIconDrawable 移动到 End|Bottom

java - Artifactory 忽略远程(maven 中央)库的版本?

android - 无法从 Android Studio 以 Debug模式运行应用程序

Android Studio 注释格式

java - 如何在不使用thread.sleep的情况下延迟android中的循环?

android - 按不在结果集中的术语排序

android - 如何将两个 mp3 音频文件混合/叠加到一个 mp3 文件中(不连接)

java - 将 MongoDB 3.4.2 与 Java 一起使用时出错

mysql - javax.json.JsonException : Cannot auto-detect encoding, 没有足够的字符

java - 为什么会出现空指针异常?