android dex2oatd e,解決android項目Error:Execution failed for task ':app:dexDebug'.ebug'錯誤

先上錯誤信息:Error:Execution failed for task ':app:dexDebug'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 3

方法一:如下圖紅色箭頭指向的,先clean 再rebuild。如果項目還報錯誤。則關閉Android studio然后重新導入項目。

2e82aae604002aba50ff958b41bc073d.png

方法二:檢查項目里的libs目錄下有沒有相同的jar包,有就刪除一個。就打開build.gradle文件,查看是否重復引入jar包的原因。下面代碼dependencies{}中可以看到引入了很多的jar包。被注釋的compile fileTree()所在的那行代碼表示引入所有的jar包,沒有注釋的代碼表示指定單個引入的jar包.

dependencies {

//compile fileTree(include: ['*.jar'], dir: 'libs')compile 'com.android.support:multidex:'compile 'com.android.support:appcompat-v7:23.2.0'compile files('libs/ShareSDK-QZone-2.7.4.jar')

compile files('libs/ShareSDK-Core-2.7.4.jar')

compile files('libs/MobTools-2016.0707.1708.jar')

compile files('libs/MobCommons-2016.0707.1708.jar')

compile files('libs/ShareSDK-SinaWeibo-2.7.4.jar')

compile files('libs/ShareSDK-Wechat-2.7.4.jar')

compile files('libs/ShareSDK-Wechat-Core-2.7.4.jar')

// compile files('libs/ShareSDK-Wechat-Favorite-2.7.4.jar')compile files('libs/ShareSDK-Wechat-Moments-2.7.4.jar')

compile files('libs/libammsdk.jar')

compile files('libs/jpush-android-2.1.5.jar')

compile files('libs/jackson-mapper-asl-1.9.10.jar')

compile files('libs/jackson-core-asl-1.9.10.jar')

compile files('libs/gson-2.3.1.jar')

compile files('libs/glide-3.7.0.jar')

compile files('libs/BmobSDK_V3.3.4_0310.jar')

compile files('libs/bitmaputils.jar')

compile files('libs/android-async-http-1.4.3.jar')

compile files('libs/AMap_Search_V3.2.1_20160308.jar')

compile files('libs/AMap_Location_V2.4.1_20160414.jar')

compile files('libs/alipaySdk-20151112.jar')

compile files('libs/afinal_0.5.1_bin.jar')

compile files('libs/umeng-analytics-v5.6.4.jar')

compile files('libs/universal-image-loader-1.9.3.jar')

compile files('libs/UPPayAssistEx.jar')

compile files('libs/UPPayPluginExStd.jar')

compile files('libs/volley.jar')

compile files('libs/ZBarDecoder.jar')

compile files('libs/zxing.jar')

}

方法三:刪除build下的文件。重新rebuild 。如下圖:

8c62a5042636731a7a14a72f4b5349a3.png

方法四:在build.gradle文件中檢查buildToolsVersion的版本是否可用(可以新建一個項目,用可以運行的buildToolsVersion版本號)。出現原因是從svn上更新項目時,更新的是同事的buildtoolsversion。所以改成自己的就好了。

7b7fd3e3301d828d21ca7e4203ecf573.png

方法五:在build.gradle文件中添加下面的代碼。忽略jar包之間可能存在的文件沖突。

packagingOptions{

exclude'META-INF/DEPENDENCIES.txt'exclude'META-INF/LICENSE.txt'exclude'META-INF/NOTICE.txt'exclude'META-INF/NOTICE'exclude'META-INF/LICENSE'exclude'META-INF/DEPENDENCIES'exclude'META-INF/notice.txt'exclude'META-INF/license.txt'exclude'META-INF/dependencies.txt'exclude'META-INF/ASL2.0'exclude'META-INF/LGPL2.1'/*exclude 'assets/lineDashTexture.png'*/}方法六:利用support 包下的multidex.jar。錯誤原因:dex超出65536。隨着項目的進行引入的jar包等一些資源越來越大。在build.gradle文件中找到defaultConfig{}在里面添加multiDexEnabledtrue,在dependencies{}里添加compile'com.android.support:multidex:'然后在你的application的onCreate()方法中添加MultiDex.install(this);defaultConfig {

multiDexEnabled true}dependencies {compile 'com.android.support:multidex:'}方法七:在builde.gragle文件中的代碼android{}里添加如下代碼:dexOptions { incremental truejavaMaxHeapSize "4g"}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值