EmptyThrowable: APK * .apk file does not exist on disk

This is an android application using gradle. After clicking Run, I found APP_V1.3.4_2016-02-22_ 11:30:29 _google_play.apk in outputs/apk , but the event log says:

11:30:31 EmptyThrowable: file APK /.../ WorkSpace / Android /.../ app / build / outputs / apk / APP_V1.3.4_2016-02-22_ 11:30:14 _google_play.apk does not exist on disk .

11:30:32 Application "Application": APK installation error

Here is my build.gradle file:

 apply plugin: 'com.android.application' def releaseTime() { return new Date().format("yyyy-MM-dd_HH:mm:ss", TimeZone.getTimeZone("GMT+08:00")) } android { compileSdkVersion 'Google Inc.:Google APIs:23' buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example" minSdkVersion 14 targetSdkVersion 23 versionCode 29 versionName "1.3.4" manifestPlaceholders = [SOME_CHANNEL_VALUE: "some_channel"] testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } signingConfigs { debug {} release { // ... } } buildTypes { debug { zipAlignEnabled true minifyEnabled false shrinkResources true } release { zipAlignEnabled true minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release applicationVariants.all { variant -> def time = releaseTime() variant.outputs.each { output -> def apk = output.outputFile def endFileName = "${time}_${variant.productFlavors[0].name}.apk" if (apk != null && apk.name.endsWith('.apk') && !apk.name.endsWith('${endFileName}')) { def fileName = "APP_V${defaultConfig.versionName}_${endFileName}" output.outputFile = new File(apk.parentFile, fileName) } } } } } productFlavors { google_play { manifestPlaceholders = [SOME_CHANNEL_VALUE: "google_play"] } } } dependencies { // ... } 

So, is there something wrong with releaseTime() ?

+2
source share
7 answers

In my case, the problem was that the apk name for the installation was cached, so every time I tried to run the application, an apk with today's date was generated, but when installing Android Studio, I looked for the apk file with the old name. The solution was to click Sync Gradle and then Build> Rebuild Project. You can also delete the app / apks and app // build / output / apk folders earlier.

+13
source

In my case, it was a problem for the version of the Android plugin. I changed it from File->Project Structure->Project and changed the Android Plugin Version to any previous version. It can be any version of Android Studio. Basically, the Android Plugin version is the version version of your Android Studio Software. It is not necessary to keep the version of the Android plugin the same as the version of the software for Android. You can provide him with any previous version of Android Studio that you installed.

+3
source

This happened in me because I deleted all the Advanced tools in the Standalone SDK Manager and downloaded the necessary tools again. * I'm not sure if this is due to a problem or not.

In any case, I tried both Sync Gradle and Rebuild Project does not solve the problem.

EmptyThrowable: APK file D: \ ... \ outputs \ apk \ app-debug.apk does not exist on disk.

I decided to click it:

Build> Build APK

A working solution for me.

+2
source

I tried all things like

  • Delete app / apks and app // build / output / apk folders earlier
  • Project syncgradle and rebuild
  • lintOptions {abortOnError false}

but the problem is solved by clicking Build> Build AIC

enter image description here

+2
source

I had the same problem and none of the above helped: neither clean / create, nor restart Android Studio / PC. The problem was that the .gradle / buildOutputCleanup / cache.properties file was blocked. Just deleting the cache.properties.LOCK file and then cleaning up the project fixes the problem.

+2
source

The reason is that Gradle calculates the time twice - once when creating apk, and then when trying to install it.

Do not calculate the time again when you create endFileName. Just do:

 def endFileName = time + "_${variant.productFlavors[0].name}.apk" 
+1
source

Rebooting Android Studio worked for me. I hope the same will work for you. The rest take a look at the link below. APK file does not exist on disk

Change If this does not work, use the Invalid Cache / Reboot menu in the File menu. Hope this helps.

0
source

Source: https://habr.com/ru/post/1257435/


All Articles