2016-06-12 81 views
0

错误这样 信息发生:摇篮任务[:应用:assembleDebug] :应用程序:预生成UP-TO-DATE :应用:preDebugBuild UP-TO-DATE :应用:checkDebugManifest :应用程序:preReleaseBuild UP-TO-DATE :应用程序:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :应用程序:prepareComAndroidSupportDesign2311Library UP-TO-DATE :应用程序:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE :应用程序:prepareComAndroidSupportRecyclerviewV72311Library UP-TO - 日期 :app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE :app:prepareComFacebookA ndroidFacebookAndroidSdk420Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE :应用程序: prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE :应用:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO -date :应用程序:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE :应用程序:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO -date :应用程序:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE :应用程序:prepareDebugDependencies :应用程序:compileDebugAidl UP-TO-DATE :应用程序:compileDebugRenderscript UP-TO-DATE :应用程序:generateDebugBuildConfig UP-TO-DATE :应用:mergeDebugShaders UP-TO-DATE :应用程序:compileDebugShaders UP-TO-DATE :应用程序:generateDebugAssets UP-TO-DATE :应用程序:mergeDebugAssets UP-TO-DATE :应用程序:generateDebugResValues UP-TO-DATE :应用程序:generateDebugResources UP-TO-DATE :应用程序:mergeDebugResources UP-TO-DATE :应用程序:processDebugManifest UP-TO-DATE :应用程序:processDebugResources UP-TO-DATE :应用程序:generateDebugSources UP-TO-DATE :应用程序:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :app:compileDebugJavaWithJavac 注意:C:\ Users \ rockstar \ Desktop \ AstroMaze \ app \ src \ main \ java \ com \ org \ astromaze \ MainActivityUsers.java使用或覆盖弃用的API。 注意:使用-Xlint:deprecation重新编译以获取详细信息。 在2.053秒内完成6个类的渐进式编译。 :应用程序:compileDebugNdk UP-TO-DATE :应用程序:compileDebugSources :应用程序:prePackageMarkerForDebug :应用程序:transformClassesWithDexForDebug 要在进程中运行DEX中,摇篮守护程序需要更大的堆。 它目前大约有910 MB。 要获得更快的构建,请将Gradle守护程序的最大堆大小增加到2048 MB以上。 要执行此操作,请在项目gradle.properties中设置org.gradle.jvmargs = -Xmx2048M。 欲了解更多信息,请参阅https://docs.gradle.org/current/userguide/build_environment.html 错误:.dex文件中的方法引用数量不能超过64K。 了解如何在https://developer.android.com/tools/building/multidex.html 解决此问题:app:transformClassesWithDexForDebug失败 错误:执行任务':app:transformClassesWithDexForDebug'失败。错误,当我在Android Studio中添加jar文件

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: 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 2 Information:BUILD FAILED Information:Total time: 17.268 secs Information:2 errors Information:0 warnings Information:See complete output in console

+0

使用以下解决方案: http://stackoverflow.com/questions/36785014/the-number-of-method-references-in-a-dex-file-cannot-exceed-64k-api-17 –

+0

when我添加了任何生成错误的lib我会尝试你的链接解决方案,但它仍然显示错误 –

回答

0

基本上是你的错误是: - 是

1) Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 

2) Error:The number of method references in a .dex file cannot exceed 64K. 

解决这些错误如下: -

1)添加multiDexEnabled真正线在你的build.gradle(模块:应用)defaultConfig

2)用下面的代码替换gradle.properties文件的全部内容: -

# Project-wide Gradle settings. 

# IDE (e.g. Android Studio) users: 
# Gradle settings configured through the IDE *will override* 
# any settings specified in this file. 

# For more details on how to configure your build environment visit 
# http://www.gradle.org/docs/current/userguide/build_environment.html 

# Specifies the JVM arguments used for the daemon process. 
# The setting is particularly useful for tweaking memory settings. 
# Default value: -Xmx10248m -XX:MaxPermSize=256m 
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

# When configured, Gradle will run in incubating parallel mode. 
# This option should only be used with decoupled projects. More details, visit 
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 
# org.gradle.parallel=true 

3)转到帮助>编辑自定义VM选项,如果扩展名为.vmoptions的文件打开,则用下面的内容替换文件内容,如果文件不存在,则创建一个,然后替换内容与此: -

# custom Android Studio VM options 

# 
# *DO NOT* modify this file directly. If there is a value that you would like to override, 
# please add it to your user specific configuration file. 
# 
# See http://tools.android.com/tech-docs/configuration 
# 
-Xms256m 
-Xmx750m 
-XX:MaxPermSize=350m 
-XX:ReservedCodeCacheSize=240m 
-XX:+UseConcMarkSweepGC 
-XX:SoftRefLRUPolicyMSPerMB=50 
-da 
-Djna.nosys=true 
-Djna.boot.library.path= 

-Djna.debug_load=true 
-Djna.debug_load.jna=true 
-Dsun.io.useCanonCaches=false 
-Djava.net.preferIPv4Stack=true 
-XX:+HeapDumpOnOutOfMemoryError 
-Didea.paths.selector=AndroidStudio2.1 
-Didea.platform.prefix=AndroidStudio 

您的所有错误将得到解决。

祝你好运。

+0

如果您发现此信息有帮助,请选择此为正确答案:)。 –

相关问题