我在android Studio

时间:2016-06-12 10:18:07

标签: android android-studio

这样的错误 信息:Gradle任务[:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :应用:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :app:prepareComAndroidSupportDesign2311Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk420Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE :应用:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:mergeDebugShaders UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :应用:compileDebugJavaWithJavac 注意:C:\ Users \ rockstar \ Desktop \ AstroMaze \ app \ src \ main \ java \ com \ org \ astromaze \ MainActivityUsers.java使用或覆盖不推荐使用的API。 注意:使用-Xlint重新编译:弃用以获取详细信息。 在2.053秒内完成6个类的增量编译。 :app:compileDebugNdk UP-TO-DATE :应用:compileDebugSources :应用:prePackageMarkerForDebug :应用:transformClassesWithDexForDebug 要在进程中运行dex,Gradle守护程序需要更大的堆。 它目前有大约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 FAILED 错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

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:进程'命令'C:\ Program Files \ Java \ jdk1.8.0_91 \ bin \ java.exe''以非零退出值2结束   信息:建筑失败   信息:总时间:17.268秒   信息:2个错误   信息:0警告   信息:请参阅控制台中的完整输出

1 个答案:

答案 0 :(得分:0)

基本上你的错误是: -

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

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

这些错误的解决方案如下: -

1)在buildConfig中的build.gradle(Module:app)中添加 multiDexEnabled true

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

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

祝你好运。