任务的Android Studio 3.1执行失败:合并dex存档时出错
android studio在执行以下生成时出现生成错误 任务“:app:transformClassesWithMultidexlistForDebug”的执行失败。 com.android.build.api.transform.TransformException:生成主索引列表时出错 这是我的gradle文件,我在其中添加了一些jar依赖项 应用程序gradle任务的Android Studio 3.1执行失败:合并dex存档时出错,android,build-error,android-studio-3.1,Android,Build Error,Android Studio 3.1,android studio在执行以下生成时出现生成错误 任务“:app:transformClassesWithMultidexlistForDebug”的执行失败。 com.android.build.api.transform.TransformException:生成主索引列表时出错 这是我的gradle文件,我在其中添加了一些jar依赖项 应用程序gradle android { compileSdkVersion 27 defaultConfig {
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.demo"
minSdkVersion 15
targetSdkVersion 27
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation files('libs/commons-codec-1.4.jar')
implementation files('libs/commons-codec-1.9.jar')
implementation files('libs/opencsv-2.4.jar')
implementation files('libs/ormlite-android-4.46.jar')
implementation files('libs/ormlite-core-4.46.jar')
implementation files('libs/Pushwoosh.jar')
implementation files('libs/StartAppInApp-2.3.2.jar')
}
格雷德尔项目
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
使用需要确保build.gradle中的multidex为真
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
您还可以创建一个扩展multidex的类,该类应该在应用程序标记中提及。在此处添加build.gradle文件和top-lavel-gradle文件我在此处添加了我的gradle文件。您的依赖项是否使用androidx?jetpack中有很多这样的问题…minSDk版本是18。但是没有luck@Godwin发布你的gradle文件