0

At the moment i can't build a new Project. (The project has only one empty activity) I don't know why is not build.. I get the error:

C:\dev\testapp\app\build\outputs\apk\debug\app-debug.apk does not exist on disk.
Error while Installing APK

I have tested with clean and rebuild, build apk, make prject, invalidate cache/restart but noting has helped.

see: The APK file does not exist on disk

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

I do not have a buildfolder in the projectdirectory/app and this is not created at build APK

existing projects work flawlessly

does anyone have an idea of what it could be and how can I fix it?

Edit: when i delete the buildfolder on an existing project i also have this error..

Andreas
  • 255
  • 3
  • 16
  • Did you change build variant? I do not why but it always happend to me when I change build variant. In my case I do uninstall of previous app version from device. – Bartosz Jul 17 '18 at 12:21
  • i didn't change anything. I have only created a new Project with an empty activity. What I also noticed is that it "R" (resources) can not resolve – Andreas Jul 17 '18 at 12:28

2 Answers2

2

First:

Go to Run -> Edit Configurations...

Make sure you have a "Gradle-aware Make" on the Before launch section:

To add it click the + sign and select Gradle-aware Make and a popup will appear, just leave the text field empty and click OK and OK.

enter image description here

Second:

enter image description here

Third:

Make sure that you don't have apostrophe or & in your path

Fourthly:

Deleting the folder .AndroidStudio[version] and losing all your preferences and caches...

Fifth:

Build ---> Build APK(s)

Sixthly:

File -> Settings -> Build, Execution, Deployment -> Instant Run -> Uncheck checkbox there

UPDATE:

 1.Open the projects gradle.properties file in android studio 

2.Added this line at end of file org.gradle.jvmargs=-Xmx1024m or org.gradle.jvmargs=-Xmx512m & Save the file

3.Close & reopen the project 
Esperanz0
  • 1,524
  • 13
  • 35
  • all this i have testet. noting work. I tested deleting the build folder on a existing project. then i get the same error – Andreas Jul 17 '18 at 12:50
  • What happens when You will run "gradlew assembleDebug" ? – Esperanz0 Jul 17 '18 at 12:52
  • Maybe try to disable instant run ? – Esperanz0 Jul 17 '18 at 12:55
  • instant run is disabled, when i try build via command line i have the error: Failure: Build failed with exception. Unable to start the deamon process. This problem might be caused by incorrect configuration is used. Could not reserver enough space for 1572864KB object heap. What can i do? – Andreas Jul 17 '18 at 13:24
  • 1
    increase heap size. check UPDATE section – Esperanz0 Jul 17 '18 at 13:30
  • android studio is on the newstest version. I have tried to insert the `org.gradle.jvmargs=-Xmx1024m` into the `gradle.properties`. the new error is `Could not find tools.jar. Please check that ... contains a valid JDK installation.` i must update the JDK right? – Andreas Jul 17 '18 at 13:44
  • so, i have copied the tools.jar vom `jdk1.8.0_161/lib` to `jre1.8.0_171/lib` building with the console still have error but in android studio i can build :-) – Andreas Jul 17 '18 at 14:02
  • lol! when i build via the android studio changes are not show – Andreas Jul 17 '18 at 14:29
0

after 3 days of searching and fustrating i have found the issue!

The problem was my SDK buildtools was on version 27.0.3 and now i have installed 28.0.1.

I think androidstudio Version 3.1.2-3.1.3 need compellingly SDK buildtool version 28 above

Andreas
  • 255
  • 3
  • 16