[英]Execution failed for task ':app:transformClassesWithMultidexlistForDebug
[英]Android - Execution failed for task ':app:transformClassesWithMultidexlistForDebug'
当我尝试运行我非常简单的Android应用程序时,我得到以下输出:
信息:Gradle:执行任务:[:app:assembleDebug]
信息:Kotlin:Kotlin JPS插件被禁用信息:6/2 / 16,11:25 AM - 编译完成,1个错误,0个警告,6s 706ms
错误:Gradle:任务':app:transformClassesWithMultidexlistForDebug'的执行失败。 com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'/Library/Java/JavaVirtualMachines/jdk1.7.0_79。 jdk / Contents / Home / bin / java''以非零退出值1结束
我原本没有使用过multidex,而且我的标准dex出现了类似的错误。 这是我没有multidex的原始输出:
信息:Gradle:执行任务:[:app:assembleDebug]
信息:Kotlin:Kotlin JPS插件被禁用信息:6/2 / 16,11:28 AM - 编译完成,1个错误,0个警告,7s 624ms
错误:Gradle:任务':app:transformClassesWithDexForDebug'的执行失败。 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''完成非零退出值1
我想我已经尝试了所有可以想到的解决方案而且没有任何作用。
这是我的应用程序级build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc4"
defaultConfig {
applicationId "com.example.XXX.testapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
// debug {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental = true;
javaMaxHeapSize "4g"
//preDexLibraries = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
我已经尝试过运行各种组合的注释和取消注释的行,你可以看到,但无济于事。
我的“lib”文件夹中没有文件。
这是我的更高级build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.XXX.testapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name="android.support.multidex.MultiDexApplication"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
如果您要整合multidex支持,那么您需要以一种令人担忧的方式做到这一点。 从这个链接
尝试进行以下更改:
在defaultConfig闭包中将multiDexEnabled true添加到gradle文件中。
在清单中,从支持库中添加MultiDexApplication类,如下所示:`
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
`
另请注意,如果您已经为项目提供了Application类,请覆盖名为attachBaseContext()的方法,并在该方法中调用:MultiDex.install(this)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.