Android Studio行为不稳定且无法成功构建

时间:2019-03-05 11:30:38

标签: android-studio android-gradle access-denied

我创建了一个无错误的android项目,并在更新了android studio后,再次打开了该项目。但是,gradle无法成功填充。 “应用”按钮like this上也有叉号。我再次尝试同步成绩,但现在android显示IDE错误并显示以下错误

java.lang.RuntimeException: Failed to create init script that applies the Java library plugin
at com.android.tools.idea.gradle.project.common.GradleInitScripts.addApplyJavaLibraryPluginInitScriptCommandLineArg(GradleInitScripts.java:102)
at com.android.tools.idea.gradle.project.sync.common.CommandLineArgs.get(CommandLineArgs.java:83)
at com.android.tools.idea.gradle.project.sync.ng.SyncExecutor.findGradleExecutionSettings(SyncExecutor.java:152)
at com.android.tools.idea.gradle.project.sync.ng.SyncExecutor.syncProject(SyncExecutor.java:131)
at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync.sync(NewGradleSync.java:185)
at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync.access$000(NewGradleSync.java:59)
at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync$2.run(NewGradleSync.java:151)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Access is denied
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at com.intellij.openapi.util.io.FileUtilRt.doCreateTempFile(FileUtilRt.java:417)
at com.intellij.openapi.util.io.FileUtilRt.createTempFile(FileUtilRt.java:379)
at com.intellij.openapi.util.io.FileUtilRt.createTempFile(FileUtilRt.java:359)
at com.intellij.openapi.util.io.FileUtilRt.createTempFile(FileUtilRt.java:352)
at com.intellij.openapi.util.io.FileUtil.createTempFile(FileUtil.java:1518)
at com.android.tools.idea.gradle.project.common.GradleInitScripts.createInitScriptFile(GradleInitScripts.java:114)
at com.android.tools.idea.gradle.project.common.GradleInitScripts.createApplyJavaLibraryPluginInitScriptFile(GradleInitScripts.java:109)
at com.android.tools.idea.gradle.project.common.GradleInitScripts.addApplyJavaLibraryPluginInitScriptCommandLineArg(GradleInitScripts.java:96)
... 19 more

这是仅访问被拒绝的问题,还是其他原因?应该做什么?我尝试在管理员模式下打开Android Studio,但也无法正常工作。

1 个答案:

答案 0 :(得分:0)

问题是用户的访问被拒绝。我获得了C盘的访问权限,问题得以解决。