当我向依赖项添加picasso时,我收到以下错误,但我无法找到解决问题的方法。请任何帮助将不胜感激。我尝试清理,重建项目并没有错误,但在运行项目时,错误显示出来。
app gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile project(':library')
compile 'com.mobprofs:retrofit-simplexmlconverter:1.1'
compile 'rubygems:json:1.8.0'
compile 'org.eclipse.birt.runtime.3_7_1:org.apache.commons.codec:1.3.0'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'it.sephiroth.android.library.picasso:picasso:2.5.2.3'
装载机:1.9.4' }
信息:Gradle任务[:app:assembleDebug]:app:preBuild :app:compileDebugNdk UP-TO-DATE:app:preDebugBuild :app:checkDebugManifest:app:preReleaseBuild:library:compileLint :library:copyReleaseLint UP-TO-DATE:library:mergeReleaseProguardFiles UP-TO-DATE:library:preBuild:library:preReleaseBuild :library:checkReleaseManifest:library:prepareReleaseDependencies :library:compileReleaseAidl UP-TO-DATE :library:compileReleaseRenderscript UP-TO-DATE :library:generateReleaseBuildConfig UP-TO-DATE :library:generateReleaseAssets UP-TO-DATE:library:mergeReleaseAssets UP-TO-DATE:库:generateReleaseResValues UP-TO-DATE :library:generateReleaseResources UP-TO-DATE :library:packageReleaseResources UP-TO-DATE :library:processReleaseManifest UP-TO-DATE :library:processReleaseResources UP-TO-DATE :library:generateReleaseSources UP-TO-DATE:library:compileReleaseJava UP-TO-DATE:库:processReleaseJavaRes UP-TO-DATE :library:packageReleaseJar UP-TO-DATE:library:compileReleaseNdk UP-TO-DATE:库:packageReleaseJniLibs UP-TO-DATE :library:packageReleaseLocalJar UP-TO-DATE :library:packageReleaseRenderscript UP-TO-DATE:library:bundleRelease 最新 :应用:prepareComAmulyakhareComAmulyakhareTextdrawable101Library 最新消息:app:prepareComAndroidSupportAppcompatV72210Library 最新消息:app:prepareComAndroidSupportMediarouterV72200Library 最新消息:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE:app:prepareComGoogleAndroidGmsPlayServices750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesAds750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesAppstate750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesBase750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesCast750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesFitness750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesGames750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesIdentity750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesLocation750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesPanorama750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library 最新消息:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library 最新 :应用:prepareComGoogleAndroidGmsPlayServicesWearable750Library 最新消息:app:prepareComJpardogoMaterialtabstripLibrary110Library 最新消息:app:prepareComPkmmteViewCircularimageview11Library 最新 :应用:prepareProjectOneLibraryUnspecifiedLibrary 最新 :应用:prepareItSephirothAndroidLibraryPicassoPicasso2523Library UP-TO-DATE:app:prepareDebugDependencies:app:compileDebugAidl UP-TO-DATE:app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE:app:generateDebugAssets UP-TO-DATE:app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE:app:generateDebugResources UP-TO-DATE:应用程序:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE:app:processDebugResources UP-TO-DATE:app:generateDebugSources UP-TO-DATE:app:compileDebugJava 注意:某些输入文件使用或覆盖已弃用的API。注意: 使用-Xlint重新编译:弃用以获取详细信息。注意:一些输入文件 使用未经检查或不安全的操作。注意:重新编译 -Xlint:取消选中以获取详细信息。 :app:preDexDebug:app:dexDebug UNEXPECTED TOP-LEVEL EXCEPTION:错误:任务执行失败 ':应用程序:dexDebug'
com.android.ide.common.internal.LoggedErrorException:无法运行命令: C:\ Users \用户RZahr \应用程序数据\本地\ AndroidStudio \ SDK \构建工具\ 21.1.2 \ dx.bat --dex --no-optimize --output D:\ AndroidStudioProjects \ ProjectOne \ app \ build \ intermediates \ dex \ debug --input列表= d:\ AndroidStudioProjects \ ProjectOne \应用\建立\中间体\ TMP \ DEX \调试\ inputList.txt 错误代码:2输出:意外的顶级异常: com.android.dex.DexIndexOverflowException:方法ID不在[0, 0xffff]:65536 at com.android.dx.merge.DexMerger $ 6.updateIndex(DexMerger.java:502)at at com.android.dx.merge.DexMerger $ IdMerger.mergeSorted(DexMerger.java:277) 在com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)at com.android.dx.command.dexer.Main.run(Main.java:246)at com.android.dx.command.dexer.Main.main(Main.java:215)at com.android.dx.command.Main.main(Main.java:106)
gradle console error:
意外的顶级例外情况: com.android.dex.DexIndexOverflowException:方法ID不在[0, 0xffff]:65536 at com.android.dx.merge.DexMerger $ 6.updateIndex(DexMerger.java:502)at at com.android.dx.merge.DexMerger $ IdMerger.mergeSorted(DexMerger.java:277) 在com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)at at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)at com.android.dx.command.dexer.Main.run(Main.java:246)at com.android.dx.command.dexer.Main.main(Main.java:215)at com.android.dx.command.Main.main(Main.java:106)
FAILED
失败:构建因异常而失败。
出了什么问题:任务执行失败':app:dexDebug'。
com.android.ide.common.internal.LoggedErrorException:无法运行命令: C:\ Users \用户RZahr \应用程序数据\本地\ AndroidStudio \ SDK \构建工具\ 21.1.2 \ dx.bat --dex --no-optimize --output D:\ AndroidStudioProjects \ ProjectOne \ app \ build \ intermediates \ dex \ debug --input列表= d:\ AndroidStudioProjects \ ProjectOne \应用\建立\中间体\ TMP \ DEX \调试\ inputList.txt 错误代码:2输出:意外的顶级异常: com.android.dex.DexIndexOverflowException:方法ID不在[0, 0xffff]:65536 at com.android.dx.merge.DexMerger $ 6.updateIndex(DexMerger.java:502)at at com.android.dx.merge.DexMerger $ IdMerger.mergeSorted(DexMerger.java:277) 在com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)at com.android.dx.command.dexer.Main.run(Main.java:246)at com.android.dx.command.dexer.Main.main(Main.java:215)at com.android.dx.command.Main.main(Main.java:106)
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。
答案 0 :(得分:1)
检查您添加的不同库,确保它们没有碰撞的依赖关系,或者库已正确添加。
我有: compile 'com.squareup.picasso:picasso:2.+'
手动禁用碰撞库模块,请按照以下示例进行操作:
compile ('com.facebook.android:facebook-android-sdk:3.22.0@aar'){
exclude module: 'support-v4'
}
修改强>
也可能是你的方法用完了。是的,这可能发生,不用担心!您需要做的是启用多索引,也称为,使您的Android构建引擎忽略65k方法限制并构建更多方法文件。
这里描述了步骤:
https://developer.android.com/tools/building/multidex.html
但是我会做一个小简历。
你必须添加这种依赖:
compile 'com.android.support:multidex:1.0.0'
这行到你的清单:
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
最后,在build.gradle文件中,您必须设置此配置设置:
defaultConfig {
...(your settings)
// Enabling multidex support.
multiDexEnabled true
}