:app:transformClassesWithMultidexlistForDebug失败 [英] :app:transformClassesWithMultidexlistForDebug FAILED
本文介绍了:app:transformClassesWithMultidexlistForDebug失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了以下链接
http://developer.android.com/intl/es/tools/building/multidex.html
无法预期的最高级别例外:com.android.dex。 DexException:多个dex文件定义
com.android.build.transform.api.TransformException
Android Studio TransformException:错误:任务':app:transformClassesWithDexForDebug'的执行失败
com.android.build.transform.api.TransformException
我的gradle构建文件如下
My gradle build file is as below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "appId"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile files('libs/rt.jar')
compile 'com.android.support:multidex:1.0.0'
}
我的清单是
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="packageName">
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我的活动文件如下。
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
毕竟,我仍然得到以下错误。
After all this, I still get the following error.
Error:Execution failed for task
':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_72\bin\java.exe'' finished with non-zero exit value 1
推荐答案
答案
我必须在应用程序级别执行以下操作
I had to do the following at the app level
- 将rt.jar删除为库
- 删除
编译文件('libs / rt.jar')
from build.gradle - 清理并构建项目。
- Remove rt.jar as library
- Remove
compile files('libs/rt.jar')
from build.gradle - Clean and build project.
感谢George Mulligan指出。
Thanks to George Mulligan for pointing it out.
这篇关于:app:transformClassesWithMultidexlistForDebug失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文