Android Studio无法正确安装build apk文件。它抛出异常

时间:2016-03-11 14:18:20

标签: android gradle build android-build

在使用Android Studio开发Android应用程序时遇到奇怪的问题。似乎AndroidStudio没有正确解析创建的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工作室中构建并尝试安装到设备后存在问题。 APK已生成,但Android Studio引用了以前存在但已被删除的错误文件。我怀疑文件名很长,但无论如何它应该可以正常工作。

1 个答案:

答案 0 :(得分:0)

如果你转到Build -> Clean,它通常会清除Android Studio的任何混淆。