Java finished with non-zero exit value 2 - Android Gradle

前端 未结 23 2391
甜味超标
甜味超标 2020-11-22 02:54

I\'m getting this error executing my Android app (I cleaned it and then built it, but the error is still present)

  • Sync: OK
  • Make Project: OK
相关标签:
23条回答
  • 2020-11-22 03:19

    I had the same issue and I fixed removing the library that were unnecessary

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

    I removed that library and I could run the project without any problem.

    0 讨论(0)
  • 2020-11-22 03:22

    in my case problem was build tools version which was 23.0.0 rc3 and i changed to 22.0.1 and my problem fixed.

    0 讨论(0)
  • 2020-11-22 03:26

    There are two alternatives that'll work for sure:

    1. Clean your project and then build.

    If the above method didn't worked, try the next.

    1. Add the following to build.gradle file at app level

      defaultConfig {   
      
      multiDexEnabled true
      
      }
      
    0 讨论(0)
  • 2020-11-22 03:27

    This error is because of using more number of libraries.in my case 'compile 'com.google.android.gms:play-services-9.4.0' caused this error.To avoid this error use necessary libraries.for example if you want to use Maps in your app.Then use compile 'com.google.android.gms:play-services-maps:9.4.0'.while adding google play services dependency specify the needed libraries only.by default it includes all the libraries.

    0 讨论(0)
  • 2020-11-22 03:27

    In Your gradle.build file, Use this

    "compile fileTree(dir: 'libs', include: ['*.jar'])"
    

    And it works fine.

    0 讨论(0)
提交回复
热议问题