当我尝试在Android studio中运行我的代码时,我遇到了很多错误。
像这样的错误要在进程中运行dex,Gradle守护程序需要一个更大的堆。它目前大约有247 MB。对于更快的构建,将Gradle守护程序的最大堆大小增加到超过2048 MB“。
其他错误类似于“错误:选择_JAVA_OPTIONS:-Xmx256M”和“错误:未捕获的翻译错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:GC超出限额“
我知道我的项目有什么问题吗?有人可以帮助我:(
这是来自我的android studio消息标签的消息。
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library
:app:prepareComAndroidSupportAppcompatV72421Library
:app:prepareComAndroidSupportMediarouterV72400Library
:app:prepareComAndroidSupportPaletteV72400Library
:app:prepareComAndroidSupportSupportCompat2421Library
:app:prepareComAndroidSupportSupportCoreUi2421Library
:app:prepareComAndroidSupportSupportCoreUtils2421Library
:app:prepareComAndroidSupportSupportFragment2421Library
:app:prepareComAndroidSupportSupportMediaCompat2421Library
:app:prepareComAndroidSupportSupportV42421Library
:app:prepareComAndroidSupportSupportVectorDrawable2421Library
:app:prepareComGoogleAndroidGmsPlayServices961Library
:app:prepareComGoogleAndroidGmsPlayServicesAds961Library
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite961Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics961Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl961Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing961Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite961Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth961Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase961Library
:app:prepareComGoogleAndroidGmsPlayServicesAwareness961Library
:app:prepareComGoogleAndroidGmsPlayServicesBase961Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement961Library
:app:prepareComGoogleAndroidGmsPlayServicesCast961Library
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework961Library
:app:prepareComGoogleAndroidGmsPlayServicesClearcut961Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive961Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness961Library
:app:prepareComGoogleAndroidGmsPlayServicesGames961Library
:app:prepareComGoogleAndroidGmsPlayServicesGass961Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm961Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity961Library
:app:prepareComGoogleAndroidGmsPlayServicesIid961Library
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps961Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation961Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps961Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby961Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama961Library
:app:prepareComGoogleAndroidGmsPlayServicesPlaces961Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus961Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet961Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager961Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi961Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks961Library
:app:prepareComGoogleAndroidGmsPlayServicesVision961Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet961Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable961Library
:app:prepareComGoogleFirebaseFirebaseAnalytics961Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl961Library
:app:prepareComGoogleFirebaseFirebaseAuth961Library
:app:prepareComGoogleFirebaseFirebaseAuthCommon961Library
:app:prepareComGoogleFirebaseFirebaseAuthModule961Library
:app:prepareComGoogleFirebaseFirebaseCommon961Library
:app:prepareComGoogleFirebaseFirebaseConfig961Library
:app:prepareComGoogleFirebaseFirebaseCrash961Library
:app:prepareComGoogleFirebaseFirebaseDatabase961Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection961Library
:app:prepareComGoogleFirebaseFirebaseIid961Library
:app:prepareComGoogleFirebaseFirebaseMessaging961Library
:app:prepareComGoogleFirebaseFirebaseStorage961Library
:app:prepareComGoogleFirebaseFirebaseStorageCommon961Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 247 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Picked up _JAVA_OPTIONS: -Xmx256M
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:3 errors; aborting
Error:Picked up _JAVA_OPTIONS: -Xmx256M
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: 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 1
Information:BUILD FAILED
Information:Total time: 3 mins 17.161 secs
Information:81 errors
Information:0 warnings
Information:See complete output in console
答案 0 :(得分:0)
这可能是因为项目中的gradle.properties中未设置内存量。转到根项目目录,找到此文件并添加以下行:
org.gradle.jvmargs = -Xmx4536m
这是我认为的最大金额。通常它设置为1536。
答案 1 :(得分:0)