Errors and solutions when using AndroidStudio to do projects

<ul><li><span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">异常log信息</span></li></ul>
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
  • the reason

This exception occurs when Android Studio is compiled and run. The reason is that duplicate jar packages are referenced in the project. This may be because the newly introduced library module contains jar packages that are repeatedly referenced in the main project. You need to focus on checking the Android compatibility package  support. -v4  and  support-v7  packages, as well as some commonly used open source projects, such as Gson, Nineoldandroids..., these commonly used open source projects may have been cited in the library project you cited .

  • Solution

You need to delete the  duplicated parts in the libs folder and library in the main project  . At the same time,  delete the corresponding dependencies in the build.gradle file directory under the module  . You can also delete the following dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

  • Exception information 2
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/ColorRes.class
  • Solution
Add the following configuration in bu ild.gradle:
configurations { all*.exclude group: 'com.android.support', module: 'support-v4' } 






Guess you like

Origin blog.csdn.net/xufei5789651/article/details/51500743