android - Android Studio无法解决:multidex打开文件

标签 android android-studio gradle resolve

无法解决:multidex
打开文件

同步项目时发现此错误。

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion rootProject.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    def system_dependencies = rootProject.ext.system_dependencies
    compile system_dependencies.appcompat_v7
    testCompile 'junit:junit:4.12'
}

我添加了它,但是它不起作用。
maven {
    url 'https://maven.google.com'
}

我尝试了很多方法。如何解决?

最佳答案

在项目build.gradle中

    allprojects {
    repositories {
        /**
         * This must be at the top.
         */
        maven {
            url 'https://maven.google.com'
        }
        // Others 
        maven { url "..." }
        jcenter()
        mavenCentral()
        google()
    }
   }

关于android - Android Studio无法解决:multidex打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53038570/

相关文章:

android - Material 日期选择器选择的日期圈不在中心,如何使其适合中心?

Android Studio 错误 JUNIT4!!! JUnit 版本 3.8 或更高版本预期为 :

android - 未找到 MotionLayout 类或未找到属性 layoutDescription

Android Gradle 同步失败 - 需要 Gradle 版本 2.2。当前版本是 5.4.1

android - 缺少类 com.google.android.datatransport.runtime.ForcedSender

android - Maps v2 为标记着色

android - 是否可以在 Android Studio 中删除我代码中的所有注释?

android - 如何防止 TouchEvent 滚动

android - 创建 Osmdroid Mapview 的屏幕截图

gradle - 如何解决 Java 12 上的 JAXB 类路径问题