Android 工作室 java.io.FileNotFoundException 出错

Error in Android studio java.io.FileNotFoundException

当我想在 phone 上调试 usb 时出现错误我无法在 phone 中的 android studio 上显示我的代码,错误如下所示:请帮助我我正在使用 android studio 2.0,我的 phone 是 ASUS Fone-Pad 8.0。

错误:java.io.FileNotFoundException:C:\Users\Andrezs\AndroidStudioProjects\HappySunday.gradle.10\taskArtifacts\cache.properties(系统找不到指定的文件)

C:\Users\Andrezs\AndroidStudioProjects\HappySunday.gradle.10\taskArtifacts\cache.properties (The system cannot find the file specified)

您应该阅读 Android Studio 2.0 更改文档。 因为在 Android Studio 中添加了一些新功能及其对其他一些功能的影响。 所以,阅读文档和问题页面,你可以解决这个问题。

根据我的看法,当您的应用 运行 在 Android Studio 的 Instant 运行 功能中发现此类错误时。因此,并非每次都生成新版本,并且在您的 android 设备中找不到应用程序内容。

解决方案this link或以下指令中定义:

<div><p style="margin:0px 0px 12px;font-family:Roboto,sans-serif;font-size:14px;line-height:24px"><font color="#000000">By default, Android Studio automatically restarts the current activity after performing a hot swap, while the app keeps running. To disable this setting:</font></p><ol style="margin:0px 0px 15px 20px;padding:0px;font-family:Roboto,sans-serif;font-size:14px;line-height:24px"><li style="margin:0px 0px 12px"><font color="#000000">Open the&nbsp;<strong>Settings</strong>&nbsp;or&nbsp;<strong>Preferences</strong>&nbsp;dialog.</font></li><li style="margin:0px 0px 12px"><font color="#000000">Navigate to&nbsp;<strong>Build, Execution, Deployment</strong>&nbsp;&gt;&nbsp;<strong>Instant Run.</strong></font></li><li style="margin:0px 0px 12px"><font color="#000000">Uncheck the box next to&nbsp;<strong>Restart activity on code changes</strong>.</font></li></ol><p style="margin:0px 0px 12px;font-family:Roboto,sans-serif;font-size:14px;line-height:24px"><font color="#000000">If automatic activity restart is disabled, you can manually restart the current activity from the menu bar by selecting&nbsp;<strong>Run</strong>&nbsp;&gt;&nbsp;<strong>Restart Activity</strong>.</font></p><h4 style="font-size:18px;line-height:24px;margin:12px 0px;font-family:Roboto,sans-serif"><a name="TOC-Using-Rerun"></a><font color="#000000">Using Rerun</font></h4><p style="margin:0px 0px 12px;font-family:Roboto,sans-serif;font-size:14px;line-height:24px"><font color="#000000">When pushing certain code changes, such as changes to an app's&nbsp;<code style="font-size:13px;font-stretch:normal;line-height:18px;font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;padding:3px 5px;background-color:rgb(247,247,247)"><a href="http://adarshf-linux.kir.corp.google.com:9000/reference/android/app/Application.html#onCreate()" style="text-decoration:none">onCreate()</a></code>&nbsp;method, you will need to restart your running app for the changes to take effect. You can click&nbsp;<strong>Rerun&nbsp;</strong></font><img border="0" src="http://tools.android.com/_/rsrc/1458888270801/tech-docs/instant-run/as-restart.png"><strong style="color:rgb(0,0,0);background-color:transparent">&nbsp;</strong><span style="color:rgb(0,0,0);background-color:transparent">to stop the app, perform an&nbsp;</span><em style="color:rgb(0,0,0);background-color:transparent">incremental build</em><span style="color:rgb(0,0,0);background-color:transparent">, and restart the app.</span></p><p style="margin:0px 0px 12px;font-family:Roboto,sans-serif;font-size:14px;line-height:24px"><font color="#000000">If you need to deploy a&nbsp;<em>clean build</em>, select&nbsp;<strong>Run</strong>&nbsp;&gt;&nbsp;<strong>Clean and Rerun 'app'</strong>&nbsp;</font><img border="0" src="http://tools.android.com/_/rsrc/1458888258422/tech-docs/instant-run/as-cleanrerun.png"><font color="#000000">&nbsp;from the main menu, or hold down the&nbsp;<strong>Shift</strong>&nbsp;key while clicking&nbsp;<strong>Rerun</strong>&nbsp;</font><img border="0" src="http://tools.android.com/_/rsrc/1458888270801/tech-docs/instant-run/as-restart.png"><font color="#000000">. This action stops the running app, performs a full clean build, and deploys the new APK to your target device.</font></p></div>

如果上述解决方案无效,请转至 project > app 文件夹 > build 文件夹并在 运行 之后再次删除构建文件夹。

退出 Android Studio,删除构建文件夹,再次打开您的项目。应该可以解决问题。

转到项目并从项目中删除.idea,.gradle & build 文件夹,然后导入项目