我该如何修复这个错误?java.lang.OutOfMemoryError(无错误消息)

5 android android-studio

构建 apk 时出错。谁收到此错误。我该如何修复此错误?

 Execution failed for task ':app:packageDebug'.
    > A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
       > java.lang.OutOfMemoryError (no error message)
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Run Code Online (Sandbox Code Playgroud)

小智 1

您可以尝试 android:largeHeap="true"在您的manifest.xml中检查您是否正在使用将大尺寸图像直接加载到xml imageView中src,或者app:srcCompat您是否可以使用像Glide https://github.com/bumptech/glide这样的库来实现这一点