当我尝试安装应用程序时,有两种可能性:
appclean build对于构建文件夹中的现有APK,该应用程序工作正常.但是当我使用Build- > 清理项目Clean Project,然后尝试运行app(即将应用程序安装到我的模拟器或物理设备)时,它会显示错误:
磁盘上不存在APK文件/Users/MyApplicationName/app/build/outputs/apk/app-debug.apk.
注意:此行为仅在我清理项目时发生,而不是在我的构建文件夹中已经有预构建的应用程序APK时
我已经提到:APK文件在磁盘上不存在,但我的观点是,当我们通常在清理项目后运行应用程序时,如果构建文件夹中不存在APK,我们永远不需要构建它,它会自动生成并安装最新版本.
我试过的事情:
Clean Project- >运行应用程序(预计将构建项目,应用程序将安装,但它显示上述错误!)Invalidate Caches/Restart将Android Studio更新到最新版本(3.1)并在我的项目中使用gradle版本后,我收到错误(链接总是不同):
12:54 Gradle sync started
12:56 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/android/tools/analytics-library/shared/26.1.0/shared-26.1.0.jar'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (1m 56s 602ms)
12:56 Gradle sync started
12:57 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/org/codehaus/mojo/animal-sniffer-parent/1.14/animal-sniffer-parent-1.14.pom'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (1m 4s 266ms)
12:58 Gradle sync started
12:59 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/all/1.2.0/all-1.2.0.pom'. …Run Code Online (Sandbox Code Playgroud)