Error in building project in Android Studio

后端 未结 10 2241
生来不讨喜
生来不讨喜 2020-12-11 14:56

Freshly Installed Android Studio and started new android project. When tried to run it. Got this error from Gradle

Error:Could not open init         


        
10条回答
  •  被撕碎了的回忆
    2020-12-11 15:35

    Error Message

    Error:Could not open initscript class cache for initialization script 
        'C:\Users\Dexter\AppData\Local\Temp\asLocalRepo10.gradle' 
        (C:\Users\Dexter\.gradle\caches\2.2.1\scripts\asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
        \InitScript\initscript)
    java.io.FileNotFoundException: C:\Users\Dexter\.gradle\caches\2.2.1\scripts\
        asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv\InitScript\initscript\cache.properties 
        (The system cannot find the file specified)`
    

    The most important parts of this error message are

    - Could not open initscript class cache
    - asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
    

    So

    • Let _XXX_ = asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
    • Let _USER_ = Dexter
    • Let _GRADLE_ = 2.2.1

    Solution

    Delete C:\Users\_USER_\.gradle\caches\_GRADLE_\scripts\_XXX_\InitScript\initscript\cache.properties.lock

    Does this not work?

    Then you have to find out the root solution. This is probably due to a corrupt IDE. Try installing another copy of Android Studio on your system.

    Note: You can have multiple copies of Android Studio on your system. Here is the latest Preview. If you check the notes on the page, you can see what you need to do to install a new version on AS.

    Let us know if this works...if not, we can try to elimate other possible issues

提交回复
热议问题