Android导入Liblary包后报Value = 2系列错误

10.导入第三方包时错误:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/squareup/picasso/Action$RequestWeakReference;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)






 FAILED


FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


BUILD FAILED


解决方案:
之前说过 value 2的问题,导入第三方libaray时有重复的架包,再看看上面的错误信息,果然有个Lcom/squareup/picasso/Action$RequestWeakReference 这个加载图片的picasso包重复,那么就要删除一个,该删哪个呢?我这里处理的时候是将工程的picasso包删掉,
保留的第三方libaray包下的picasso包。问题解决了。工程下的picasso也是可以用的。
注意:删除picasso包后记得取消依赖。


11、导入第三方包时错误提示:


Error:duplicate files during packaging of APK D:\Develop\Android\workspace\androidstudio\MLTimeLine\app\build\outputs\apk\app-debug-unaligned.apk
     Path in archive: META-INF/NOTICE
     Origin 1: D:\Develop\Android\workspace\androidstudio\MLTimeLine\app\libs\httpcore-4.3.jar
     Origin 2: D:\Develop\Android\workspace\androidstudio\MLTimeLine\app\libs\httpmime-4.3.1.jar
You can ignore those files in your build.gradle:
     android {
       packagingOptions {
         exclude 'META-INF/DEPENDENCIES'
         exclude 'META-INF/NOTICE'
         exclude 'META-INF/LICENSE'
       }
     }
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/NOTICE
     File 1: D:\Develop\Android\workspace\androidstudio\MLTimeLine\app\libs\httpcore-4.3.jar
     File 2: D:\Develop\Android\workspace\androidstudio\MLTimeLine\app\libs\httpcore-4.3.jar


这个也是jar.包重复。


解决办法:在工程的build.gradle文件的Android{  }里面加入
packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
          exclude 'META-INF/NOTICE.txt'
          exclude 'META-INF/LICENSE.txt'
       }
这些代码吧,报错信息里面都有提示的。
或者是将重复的包删除一个。

你可能感兴趣的:(command,process,faile,Android导包错误,ErrorExecution,Djdk)