报错Execution failed for task ‘:app:processDebugResources‘.

android studio 运行程序时候报错Execution failed for task ‘:app:processDebugResources’.

具体提示信息为:

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform lifecycle-livedata-core-2.0.0.aar (androidx.lifecycle:lifecycle-livedata-core:2.0.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.status=release}.
      > Execution failed for LibrarySymbolTableTransform: C:\Users\zhangyuan\.gradle\caches\transforms-2\files-2.1\1435e0b5216c3fd72a2d6579c29d3ee1\lifecycle-livedata-core-2.0.0.
         > Cannot parse result path string:                                           
   > Failed to transform core-runtime-2.0.0.aar (androidx.arch.core:core-runtime:2.0.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.status=release}.
      > Execution failed for LibrarySymbolTableTransform: C:\Users\zhangyuan\.gradle\caches\transforms-2\files-2.1\035487676af6db782633ffbdc1d98b21\core-runtime-2.0.0.
         > Cannot parse result path string:                             
   > Failed to transform core-runtime-2.0.0.aar (androidx.arch.core:core-runtime:2.0.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.status=release}.
      > Execution failed for LibrarySymbolTableTransform: C:\Users\zhangyuan\.gradle\caches\transforms-2\files-2.1\035487676af6db782633ffbdc1d98b21\core-runtime-2.0.0.
         > Cannot parse result path string:

出现背景:

第一次编译运行时使用了自带的安卓虚拟机
机型 pixel 4 xl,系统版本 x86 Android 5.0 x86_64 (google APIs)
运行时虚拟机未运行完电脑就蓝屏重启了,然后接入自己的小米9,尝试运行,就出现了这个情况

解决方法:

将 Android studio 卸载干净以后(为了卸载干净需要删除一些关联文件,详情请百度),重新安装部署,然后直接在小米9上重新编译运行项目,就没有问题了

解决过程:

代码核对了三遍,保证没有问题

百度搜到的方法都试过了,

比如更改 gradle 版本、
比较compileSdkVersion和 targetSdkVersion版本、
在项目的build.gradle 的buildscript 和 allprojects同时加上mavenCentral()和google()
clean项目缓存重新加载一下
升级gradle
更改Gradle插件版本

都没有作用,最后怀疑是因为蓝屏重启导致的程序文件损坏,尝试完全卸载后重新安装

后来使用这个命令又刷新了一下错误信息gradlew compileDebug --stacktrace -debug
出现了一下提示

FAILURE: Build failed with an exception.
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Unable to start the daemon process.
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] This problem might be caused by incorrect configuration of the daemon.
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] For example, an unrecognized jvm option is used.
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.5/userguide/gradle_daemon.html
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Process command line: C:\Program Files (x86)\Java\jdk1.8.0_121\bin\java.exe -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\User
s\zhangyuan\.gradle\wrapper\dists\gradle-6.5-bin\6nifqtx7604sqp1q6g8wikw7p\gradle-6.5\lib\gradle-launcher-6.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.5
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please read the following process output to find out more:
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] -----------------------
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Error occurred during initialization of VM
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not reserve enough space for 2097152KB object heap
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2021-03-05T20:56:01.123+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.GradleException: Unable to start the daemon process.
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] This problem might be caused by incorrect configuration of the daemon.
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] For example, an unrecognized jvm option is used.
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.5/userguide/gradle_daemon.html
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Process command line: C:\Program Files (x86)\Java\jdk1.8.0_121\bin\java.exe -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\User
s\zhangyuan\.gradle\wrapper\dists\gradle-6.5-bin\6nifqtx7604sqp1q6g8wikw7p\gradle-6.5\lib\gradle-launcher-6.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.5
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please read the following process output to find out more:
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] -----------------------
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Error occurred during initialization of VM
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not reserve enough space for 2097152KB object heap
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DaemonGreeter.parseDaemonOutput(DaemonGreeter.java:38)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:176)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:137)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DefaultDaemonConnector.doStartDaemon(DefaultDaemonConnector.java:217)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:211)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:133)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:145)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:99)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:56)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:212)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:294)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:266)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:82)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:30)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:92)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:38)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:44)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:26)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:41)
2021-03-05T20:56:01.124+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:26)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:259)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.Main.doAction(Main.java:35)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.lang.reflect.Method.invoke(Method.java:498)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.lang.reflect.Method.invoke(Method.java:498)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2021-03-05T20:56:01.125+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org

然后发现它提示了一句:Could not reserve enough space for 2097152KB object heap,

而实际的物理内存是足够的,百度说原因可能是因为使用了32位的JDK。

于是通过在cmd里输入 java -version 查看JDK版本是32位还是64位。
如果输出中包含64,如:Java HotSpot™ 64-Bit Server VM,则为64位,否则为32位

而我安装的确实是Java 1.8.0_121 32位版,是老师给的
所以尝试卸载后安装64位版试试
于是将jdk版本换成了 Java 1.8.0_202 64位版

安装完以后还是不行,依旧是这个错误,最后决定重装

你可能感兴趣的:(日常,android,studio)