无法在Android Studio上解析配置':classpath'的所有依赖项

时间:2023-01-26 20:56:17

I got this error when opening Android Studio.

打开Android Studio时出现此错误。

I've never gotten this error before. I've tried cleaning and re-synchronizing gradle, I've updated all packages in SDK Manager,

我以前从来没有弄过这个错误。我已经尝试清理并重新同步gradle,我已经更新了SDK Manager中的所有软件包,

I've restarted my Android Studio,

我重新启动了我的Android Studio,

I've run it as administrator,

我以管理员身份运行它,

I also have tried building a new project, but this error won't go away.

我也尝试过构建一个新项目,但这个错误不会消失。

Please help me to solve this problem.

请帮我解决这个问题。

Error:Failed to create parent directory 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4' when creating directory 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401'

[UPDATE]

After I've tried rebuilding my project, I got a new error like this.

在我尝试重建我的项目后,我得到了一个像这样的新错误。

Error:A problem occurred configuring root project 'BPSGoSurvey'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve commons-logging:commons-logging:1.1.1.
     Required by:
         :BPSGoSurvey:unspecified > com.android.tools.build:gradle:1.3.0 > com.android.tools.build:gradle-core:1.3.0 > com.android.tools.build:builder:1.3.0 > com.android.tools:sdklib:24.3.0 > org.apache.httpcomponents:httpclient:4.1.1
         :BPSGoSurvey:unspecified > com.android.tools.build:gradle:1.3.0 > com.android.tools.build:gradle-core:1.3.0 > com.android.tools.build:builder:1.3.0 > com.android.tools:sdklib:24.3.0 > org.apache.httpcomponents:httpmime:4.1
      > Could not resolve commons-logging:commons-logging:1.1.1.
         > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
            > Could not resolve org.apache.commons:commons-parent:5.
               > Could not resolve org.apache.commons:commons-parent:5.
                  > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/org/apache/commons/commons-parent/5/commons-parent-5.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download8245895784892794258bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
               > Could not resolve org.apache.commons:commons-parent:5.
                  > Could not parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/5/commons-parent-5.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download3502880229047415896bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
      > Could not resolve commons-logging:commons-logging:1.1.1.
         > Could not parse POM https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
            > Could not resolve org.apache.commons:commons-parent:5.
               > Could not resolve org.apache.commons:commons-parent:5.
                  > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/org/apache/commons/commons-parent/5/commons-parent-5.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download6416635460030578050bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
               > Could not resolve org.apache.commons:commons-parent:5.
                  > Could not parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/5/commons-parent-5.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download916061549622655000bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
   > Could not resolve commons-codec:commons-codec:1.4.
     Required by:
         :BPSGoSurvey:unspecified > com.android.tools.build:gradle:1.3.0 > com.android.tools.build:gradle-core:1.3.0 > com.android.tools.build:builder:1.3.0 > com.android.tools:sdklib:24.3.0 > org.apache.httpcomponents:httpclient:4.1.1
      > Could not resolve commons-codec:commons-codec:1.4.
         > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/commons-codec/commons-codec/1.4/commons-codec-1.4.pom
            > Could not resolve org.apache.commons:commons-parent:11.
               > Could not resolve org.apache.commons:commons-parent:11.
                  > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/org/apache/commons/commons-parent/11/commons-parent-11.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download8269455495978527180bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
               > Could not resolve org.apache.commons:commons-parent:11.
                  > Could not parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download3692548803835443828bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
      > Could not resolve commons-codec:commons-codec:1.4.
         > Could not parse POM https://jcenter.bintray.com/commons-codec/commons-codec/1.4/commons-codec-1.4.pom
            > Could not resolve org.apache.commons:commons-parent:11.
               > Could not resolve org.apache.commons:commons-parent:11.
                  > Could not parse POM file:/E:/Android%20Studio/gradle/m2repository/org/apache/commons/commons-parent/11/commons-parent-11.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download5076305514553905674bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 
               > Could not resolve org.apache.commons:commons-parent:11.
                  > Could not parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom
                     > Could not resolve org.apache:apache:4.
                        > Could not resolve org.apache:apache:4.
                           > Could not get resource 'https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom'.
                              > Failed to move file 'C:\Users\User\AppData\Local\Temp\gradle_download1507005468069947828bin' into filestore at 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache\apache\4\602b647986c1d24301bc3d70e5923696bc7f1401\apache-4.pom' 

1 个解决方案

#1


0  

Since its a gradle cache directory, try deleting it (or its parent directory) forcefully. Some other process may have locked that directory not allowing Studio to access it. After deleting, close all processes associated with Android Studio (adb, studio.exe, java.exe, etc). Then try restarting Studio.

由于它是一个gradle缓存目录,请尝试强制删除它(或其父目录)。某些其他进程可能已锁定该目录,但不允许Studio访问它。删除后,关闭与Android Studio关联的所有进程(adb,studio.exe,java.exe等)。然后尝试重新启动Studio。

#1


0  

Since its a gradle cache directory, try deleting it (or its parent directory) forcefully. Some other process may have locked that directory not allowing Studio to access it. After deleting, close all processes associated with Android Studio (adb, studio.exe, java.exe, etc). Then try restarting Studio.

由于它是一个gradle缓存目录,请尝试强制删除它(或其父目录)。某些其他进程可能已锁定该目录,但不允许Studio访问它。删除后,关闭与Android Studio关联的所有进程(adb,studio.exe,java.exe等)。然后尝试重新启动Studio。