5

Whenever I debug application, error appears that ... .apk file does not exist on a disk and app doesn't launch.

After updating Android Studio, this error started happening.

I tried different solutions after a lot of searching. This includes:

  1. Downgrading Android Studio (it starts giving plugins error and I don't want not to be able to use new Android Studio)
  2. Tried this solution with no luck.
  3. This catering different problem but with possible solution of my problem. It didn't work too.
  4. Referred to the issue

Any help will be appreciated.

Community
  • 1
  • 1
Waqas Ahmed Ansari
  • 1,683
  • 15
  • 30

2 Answers2

6

If you have something like this in your build.gradle file:

applicationVariants.all { variant ->
    variant.outputs.each { output ->
         output.outputFile = new File(output.outputFile.parent, baseFilename + defaultConfig.versionCode + "_" + defaultConfig.versionName + "_" + getDate() + ".apk")
    }
}

And this

def getDate() {
    def date = new Date()
    def formattedDate = date.format('dd.MM.yyyy')
    return formattedDate
}

You should remove getDate() from output to fix your problem. Take a look at this post also.

Community
  • 1
  • 1
Andrey Mohyla
  • 218
  • 7
  • 17
2

Check your path to your apk. Might there be some special characters in folder names. This also cause the adb to through this error.

SAIR
  • 1,121
  • 11
  • 31