【问题标题】:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'任务“:app:transformClassesWithMultidexlistForDebug”执行失败
【发布时间】:2016-05-30 10:13:18
【问题描述】:

错误 错误:任务 ':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 .7.0_79\bin\java.exe'' 以非零退出值 1 结束

我的 gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0 rc3"

defaultConfig {
    applicationId "com.example.sagar.shavanma"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

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


dependencies {

compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
}

网格

:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE :app:prepareComAndroidSupportCardviewV72330Library UP-TO-DATE :app:prepareComAndroidSupportDesign2330Library UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42330Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE :app:prepareComAndroidVolleyVolley100Library UP-TO-DATE :app:prepare ComGithubNirhartParallaxscroll10Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl 最新 :app:compileDebugRenderscript 最新 :app:generateDebugBuildConfig 最新 :app:generateDebugAssets 最新 :app:mergeDebugAssets 最新 :app:generateDebugResValues 最新 :app:generateDebugResources 最新 :app:mergeDebugResources 最新 :app:processDebugManifest 最新 :app:processDebugResources 最新 :app:generateDebugSources 最新 :app:compileDebugJavaWithJavac 注意:某些输入文件使用或覆盖已弃用的 API。 注意:使用 -Xlint:deprecation 重新编译以获取详细信息。 注意:某些输入文件使用未经检查或不安全的操作。 注意:使用 -Xlint:unchecked 重新编译以获取详细信息。 :app:compileDebugNdk 最新 :app:compileDebugSources :app:prePackageMarkerForDebug :app:transformClassesWithJarMergingForDebug :app:collectDebugMultiDexComponents :app:transformClassesWithMultidexlistForDebug ProGuard,版本 5.2.1 读取程序jar [G:\Projects\Shavanma\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar] 读取库 jar [C:\Users\shree\AppData\Local\Android\sdk\build-tools\24.0.0-preview\lib\shrinkedAndroid.jar] 准备输出 jar [G:\Projects\Shavanma\app\build\intermediates\multi-dex\debug\componentClasses.jar] 从程序 jar 复制资源 [G:\Projects\Shavanma\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar] :app:transformClassesWithMultidexlistForDebug 失败 错误:任务 ':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 .7.0_79\bin\java.exe'' 以非零退出值 1 结束

【问题讨论】:

  • libs 文件夹中有什么?
  • 除此之外,您还可以阅读此解决方案。 stackoverflow.com/questions/36698816/…
  • @cricket_007-它是空的
  • 好的,那么剩下的错误说明了什么?
  • @cricket_007..只有一个错误

标签: android android-studio


【解决方案1】:

尝试在你的 build.gradle 文件中添加这个: 依赖下

compile 'com.android.support:multidex:1.0.0'

然后为您的应用创建一个全局应用程序类:

import android.support.multidex.MultiDex;
public class Global_class extends Application {

 protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
   }
}

在你的清单文件中的应用标签下添加这个类

 <application
    android:name="com.package_name.Global_class"
 </application>

【讨论】:

  • 如果你不需要multidex,那么没有理由添加它。它也可能无法解决问题
  • 尝试删除 app/build 文件夹然后调试,不要在 libs 文件夹中添加外部 jar 文件。清理项目并重新构建它。调试时尝试使用 stackTrace 选项
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-23
  • 2018-06-09
  • 2018-08-01
  • 2018-04-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多