使用Android Studio开发Android应用程序时遇到奇怪的问题。似乎AndroidStudio无法正确解析创建的apk文件并尝试使用旧的apk文件。这可能是由于文件名过长而引起的,但仍然可以正常工作。

Preconditions:
Android Studio v1.5.1
Java: 1.7.0_80 b15
SDK API21




Error:
The APK file /home/rafal/git_repo/osmand/android/OsmAnd/build/outputs/apk/OsmAnd-v0.11-7-g79e6e30-free-legacy-armv5-debug.apk does not exist on disk.
com.intellij.openapi.diagnostic.Logger$EmptyThrowable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:117)
    at com.android.tools.idea.run.AndroidRunningState.installApks(AndroidRunningState.java:450)
    at com.android.tools.idea.run.AndroidRunningState.prepareAndStartApp(AndroidRunningState.java:380)
    at com.android.tools.idea.run.AndroidRunningState.access$1000(AndroidRunningState.java:72)
    at com.android.tools.idea.run.AndroidRunningState$3.onSuccess(AndroidRunningState.java:320)
    at com.android.tools.idea.run.AndroidRunningState$3.onSuccess(AndroidRunningState.java:303)
    at com.google.common.util.concurrent.Futures$5.run(Futures.java:1231)
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    at com.google.common.util.concurrent.Futures$ImmediateFuture.addListener(Futures.java:104)
    at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1234)
    at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1170)
    at com.android.tools.idea.run.AndroidRunningState.start(AndroidRunningState.java:303)
    at com.android.tools.idea.run.AndroidRunningState$1.run(AndroidRunningState.java:266)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)

在Anroid Studio中构建并尝试安装到设备后,存在问题。
APK已生成,但Android Studio引用了以前存在但已删除的错误文件。我怀疑文件名太长,但无论如何应该可以正常工作。

最佳答案

如果您转到Build -> Clean,通常会清除Android Studio的任何困惑之处。

关于android - Android Studio无法正确安装构建apk文件。引发异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35942522/

10-10 10:31
查看更多