app-debug.apk 在磁盘上不存在。安装 APK 时出错

app-debug.apk does not exist on disk. Error while Installing APK

大家好尝试启动我的应用程序(直到今天一直有效!!!)继续出现此错误:

The APK file C:\Users\User\Documents\App 0.0\Dooale\app\build\outputs\apk\debug\app-debug.apk does not exist on disk. Error while Installing APK

我试图在我的电脑上验证指定的路径:C:\Users\User\Documents\App 0.0\Dooale\app\build\outputs\但实际上不存在! 在输出中只有日志! 这怎么可能?我能做什么?

谢谢大家

我设法解决了这些简单的步骤:

1 - 我去了 android 工作室的 Build -> Clean Project 等它结束后。 2 - 我回到构建 -> 重建项目

3 - 我与 Gradle 重新同步。

通过这些简单的步骤,我设法解决了!!!

这个愚蠢的错误浪费了一整天的研究。

最近我将 REST 库 Fuel 替换为 Retrofit 并添加了 OkHttp 日志拦截器及其 Proguard 规则。然后我删除了拦截器但忘了删除 Proguard 规则。

这个错误出现在第二天。建不了工程,连AS都重装了。然后我用 Build > Generate Signed Bundle / APK 构建了一个 apk。我在那里看到了警告:

AGPBI: {"kind":"warning","text":"Missing class: android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}

AGPBI: {"kind":"warning","text":"The rule -keep public class *extends androidx.versionedparcelable.VersionedParcelable {\n \u003cinit\u003e();\n} uses extends but actually matches implements.","sources":[{}],"tool":"D8"} AGPBI: {"kind":"warning","text":"Type org.conscrypt.Conscrypt was not found, it is required for default or static interface methods desugaring of void okhttp3.internal.platform.ConscryptPlatform.configureSslSocketFactory(javax.net.ssl.SSLSocketFactory)","sources":[{"file":"C:\Users\user\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp.12.0\b36f4a04584c0fb0d9af2d3401cdff8dacb1ea54\okhttp-3.12.0.jar"}],"tool":"D8"}

然后我从 Proguard 中删除了不必要的行。参见 How to resolve D8 warning: D8: Type `org.conscrypt.Conscrypt` was not found

更新

几个小时后,即使我恢复到以前的提交,问题也消失了。它也没有在另一台 PC 上重现。 Android工作室很奇怪。

为了不在每次更改代码时都重新构建项目,我将其添加到配置中(参见 )。

更新 2

我使用 Retrofit 并将所有响应文件(JSON 结构)保存在一个包中。我不得不将它们添加到 proguard-rules.pro:

-keep class com.example.data.network.model.** { *; }

如果我删除此行,应用程序将不会编译并显示消息:"AGPBI: {"kind":"warning","text":"Missing class: android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}".