apk does not exist on disk with a new Project - android

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..

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.
Second:
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

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

Related

Entry name 'org/joda/time/tz/data/Europe/Dublin' collided

I got this error suddenly when compiled a signed Apk, and not sure how to fix it.
Entry name 'org/joda/time/tz/data/Europe/Dublin' collided
It's not pointing to any line, this is the Joda library import:
implementation "joda-time:joda-time:2.9.9"
I got the same error on the latest JodaTime version - 2.10.5. But only with some flavors. It seems as a gradle build error.
In the my case - I have deleted ./app/build/ folder and then start "Invalidate cache and restart".
If anyone else is trying to generate an APK (and your APK output folder is outside of the build folder), but still having issues after deleting the build folder, and doing "Invalidate cache and restart" on Android Studio, try deleting the previously generated .apk file from your respective APK output folder. See first answer in related question Can't run nor debug project but gradle build+install work
I had this issue but only on one build variant, I made sure all my gradle files were up-to date but that didn't fixed it.
To solve it I closed android studio and navigated to the project file click on the app folder and deleted the build folder.
Once deleted I reopened Android Studio and launched the android project,
I then clicked File -> Invalidate Caches / Restart -> Invalidate and Restart.
This worked for me and can now run every build variant without any problems, I've not had the same issue since.
After try everything on all forums, I just opened the route for the file on Notepad++, after on my project, tried the Signed bundle and the Signed APK... both works excellent now haha.
Hope this works for you.
enter image description here

How to solve Specified AAPT2 executable does not exist on Android Studio 3.2

I've an issue with Android Studio. I'm trying to use it on Windows but I've trouble during the project's build process.
First, notice Android Studio is installed on my secondary HDD.
When I try to build/run my project I get this error:
Specified AAPT2 executable does not exist:
C:\Users\Rémi\\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\35960bdffa2420a45dff6ec260c07fa9\aapt2-3.2.0-4818971-windows\aapt2.exe
And indeed there is no aapt2.exe here.
But I've found this .exe here:
H:\Logiciels\AndroidStudioSDK\build-tools\28.0.2\aapt2.exe
and a previous version here:
H:\Logiciels\AndroidStudioSDK\build-tools\27.0.3\aapt2.exe
I've tried to fix this issue by changing the build tools version by setting File > Project structure > Modules > App > Build Tools Version. This option was empty and I chose 28.0.2 but that doesn't change anything.
Thanks for reading.
P.S.: This question is not the same. My error is different and I have google() in my Grable file.
I solved it by deleting the directory under which it expected the aapt2 executable, e.g. C:\Users\support\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4c1f5b7dca1d5d378360be7f3fd9726a\aapt2-3.2.1-4818971-windows and then did a clean in Android Studio Build>Clean Project.
Afterwards it appears to have downloaded this again, with the missing executable, and now works perfectly.
I had the same issue. I resolved it by opening my file browser and navigating to this folder
C:\Users\(My User Name)\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar
Opening this folder and viewing its contents, I deleted the folder labeled 81c3666e327fa931c773a52e6cb0b3b7 which for you would be 35960bdffa2420a45dff6ec260c07fa9.
After this I went back to Android Studio and clicked the Build menu, and used the Clean Project option, followed by the Rebuild Project option.
I no longer get this error, or all the debug errors that say the Java package "R" did not exist.
I hope this helps.
Following solved my issue
under jar folder there are 3 folders, one of the folder consists of the aapt2.exe in it.
I copied that file to other folder where I am getting error.
ex:
path of jar: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar
error path: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a57a698502c21bfe8cfc3ed6eb102b39\aapt2-3.2.1-4818971-windows
copied aapt2.exe file from 57f15fb82085ec9389484ff7e041344f folder to a57a698502c21bfe8cfc3ed6eb102b39
Hope this helps..
I resolved this issue by removing that folder
Go to that path -> Delete
Ex: C:\Users\Rémi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\35960bdffa2420a45dff6ec260c07fa9\aapt2-3.2.0-4818971-windows\aapt2.exe
In this go to "C:\Users\Rémi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\" and delete 35960bdffa2420a45dff6ec260c07fa9
Clean Project and Build
1- enter to the file like
C:\Users\4khalil\.gradle\caches\transforms-1\files-1.1\aapt2-3.3.2-5309881-windows.jar\6abc6a09978228d11497e7ca9c3de2c9\aapt2-3.3.2-5309881-windows
then if you find aapt2.exe.dat, delete the extension .dat to be aapt2.exe
and the problem will be solved.
You can use 'invalidate cache and restart'.
In Android Studio, go to File menu -> click Invalidate Caches/Restart.
Just chnage the gradle version in your build.gradle file in android folder.
For example mine was 4.1.0, changed it to 4.1.1
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
just copy paste this file aap2.exe get it from a friend or somewhere at this location and paste it on the same folder found in yours in .gradle C:\Users\Dina.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\8735df2342ae4ae127451389faa5e1f1\aapt2-3.2.1-4818971-windows\
then build and then the build will complete successful.
I didn't know how to attach the file in my answer I am new to stack overflow.

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every
Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
After getting this error AS stop compilation of this module so that I am not able to compile/run my project any more.
1- close the project
2- close Android Studio IDE
3- delete the .idea directory located inside the project folder
4- delete all .iml files
5- open Android Studio IDE and import the project
First of all you should update to Android Studio 1.2
Source: https://code.google.com/p/android/issues/detail?id=77983
Then you should go to File -> Invalidate Caches / Restart -> Invalidate Caches & Restart.
Then try to build the application again.
Invalidate Caches and Restart did not work for me. I also updated all my Android Studio files with no success.
The solution I found was importing the android folder by clicking "Import project (Eclipse ADT, Gradle, etc.)" rather than clicking "Open an existing Android Studio Project" or dragging the folder onto the app icon.
Apparently the problem is caused because a module in the project has an *.iml file that does not contain external.system.id="GRADLE".
When you import the project (as opposed to opening it), the iml files are completely re-written, thus removing the error.
I found the info here: https://issuetracker.google.com/issues/37008041
Goto .idea/modules.xml & delete the invalid/not existing path <module />. Then File => Invalidate Caches / Restart.
Try this if it helps File -> Invalidate Caches / Restart.
If it still doesn't help click on the button in the image.
'Sync Project with Gradle Files'
I know it's an old question. but I faced this problem after updating to Android Studio 3.0. I solved it by deleting app.iml file inside my app module and then Invalidate Caches / Restart.
In my case settings.gradle contained invalid configuration.
I changed:
include ':app'
rootProject.name='<somthing else>'
To:
include ':app'
Error is gone. So maybe check your settings.gradle for potential errors. If this won't work try to remove cache and other tips.
Delete .idea/modules.xml
Reload All Gradle Projects
You do not want to remove entire .idea directory, because it contains e.g. dictionaries and shelved changes.
If the above doesn't help you - check your module .iml file and see if it contains any errors. (for the app module it will be app.iml).
Invalidating caches/Restart didn't worked for me.
But simply deleting the caches folder in \Users\user.AndroidStudio(version)\system worked like a charm
You may resolve by below process:
In Android Studio, go to left panel, switch from Android to Project pane
Expand .idea folder, you can see modules.xml and open the file.
In the modules.xml file, you might see like below:
<component name="...">
<modules>
<module fileurl="file://$PROJECT_DIR$/[check...].iml" filepath="$PROJECT_DIR$/[check...].iml" group="myProject" />
<module fileurl="file://$PROJECT_DIR$/app/[check...]-app.iml" filepath="$PROJECT_DIR$/app/[check...]-app.iml" group="[check...]/app" />
Check that match the module name correctly in module element
And then, sync the gradle file
Close the Android Studio and Move ".idea" Folder and paste it outside Project root folder( For Back up if you need).
Open the Android studio.
On Opening the project it"ll ask add module (app) to your project. You can ignore the same.
It set set default build variant to be "debug".
You can see build variant tab on left corner or hover on "Monitor" Symbol on left bottom
Note: No need to change your .iml file of your project.tom to get build variant option and "Invalidate Cache and Restart" will also not work rather it will clear your history files too!.
I solved a similar problem by closing the project, then re-importing the project (not opening, but re-importing as an eclipse or other project)
Try the below,
Close android studio
Then delete .iml , .idea files
Open again the android studio
Sync with Gradle.
In My Case
I have deleted
android -> .idea Folder
android -> appname.iml file
android -> app -> app.iml file
Open project in Android Studio and no need to File -> Invalidate Caches/Restart
You can do Invalidate Caches / Restart for your case.
The above solution I've tried but didn't work for me.
I deleted the .idea folder from project directory.
Invalidate caches using Android Studio menu File -> Invalidate Caches / Restart
Deleted .gradle folder from user profile directory of Windows 10 operating system. (i.e., C:\Users\YourUserName\.gradle)
Try this solution if the above not working.
You should import the the project
https://issuetracker.google.com/issues/37008041
This error shows up when there is a module in your project whose .iml file does not contain:
external.system.id="GRADLE" Can you please check your .iml files? Also, instead of opening the project, import it, that will completely rewrite your .iml files and you won't see that error again.
Try this steps Individually:-
1) Go to File->Invalidate Caches / Restart.
2) Close android studio, Go to C:\Users\(Your UserName)\.AndroidStudio(version)\system and delete caches folder.
If till now nothing worked, then this step will definitely work...
3) Simply change project location and import project with new location.
Enjoy :-):-)
Step 1 : Delete .iml file
Step 2 : Check if your Project Directory Contain any white spaces if so then Rename your project directory leaving space
ex:
Before : My Project
After rename : MyProject
and open Android Studio...
For windows users, this can also be caused by filesystem corruption.
If all steps above do not correct the error:
Close Android Studio
Open Command Prompt as Administrator
Run a chkdsk /f on the drive your app is stored
Delete .idea folder
Restart Android Studio
save .idea folder somewhere else (for backup)
remove .idea folder
start AndroidStudio
select project
[there may be an error, ignore that]
click File -> Invalidate Caches/ Restart
click button: Invalidate Caches/ Restart
resolved
Delete .idea folder
Close project ->
Reopen Project ->
Invalidate Caches / restart
You can update new version of Android studio then go to invalidate catches/restart.Click sync button build application.
In my case I cloned a git-project where both Java and Kotlin included. Then checked another branch and pressed "Sync Project with Gradle Files". Android Studio 3.0.1.
I had the same issue on androidStudio 3.2 and clonning the project worked for me
In my case it is because the root project name have a space.
So instead of naming it as sample project, it should be sample-project or sample_project.
click File -> Invalidate Caches/ Restart doesn't help you anymore
Delete .iml , .idea files & folders from file explorer not inside android studio
1) Open android studio with different/another project
2) import project newly not from recent
3) build the project again
sure it will work
I had the exact same error and it was so annoying to see the alert every time I stared Android Studio. I tried the solution mentioned above including invalidating cache, restart etc, nothing made it go away.
In my case, we had a module that was deleted from source and the reference also removed from settings.gradle. Turns out, .idea/modules.xml was still referencing that module.
All I needed to do was remove that line from <modules> in .idea/modules.xml and it made it all go away.
I have the same issue. I was tried Invalidate Cache / Restart & also sync project with Gradle Files but still didn't work.
But worked by use the following steps:
upgrading gradle distribution version at gradle.wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
And also Android Gradle Plugin at build.gradle project
classpath 'com.android.tools.build:gradle:4.1.2' //upgrade gradle plugin here
Then Invalidate Cache / Restart
That's all solved my problem. Hope you too
rename project directory fix error for me, android studio 3.4.2

Android Studio "Project Structure" not coming properly

I follow all the necessary steps for Android Studio installation. I also checked this question, but still facing the same issue.
But whenever I create any new project, following screen come. I couldn't found any project structure as I can see in Eclipse.
Here, I can't find any "src","res" or any file structure. Any idea, how to get proper Project Structure?
when I tried to add "New Module" following error comes to submit.
No message
java.lang.IllegalStateException:
at com.android.tools.idea.wizard.NewModuleWizard.onFailure(NewModuleWizard.java:159)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:340)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$1.run(ExternalSystemUtil.java:364)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:493)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:304)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:185)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:175)
at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:695)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:458)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:154)
When I go to Edit Configuration, can't create any module due to above error.
Go to File > Project Structure > Project Settings > Modules.
Click on the green colored + and add new module.
select Application module and set the content root to your project module.
Click next and then finish.
This should do the trick and the complete project structure will appear.
It worked for me.
Change the SDK to a level that you have installed in the SDK manager. The SDK manager can be accessed from Tools -> Android -> SDK Manager. For me, Android Studio was packaged with API Level 17 but the new project wizard tried to target API Level 18.
When something like that happens to me, to fix it, I go to
File -> Project Structure -> Modules, click (+) to add a module.
To import the main module you have to search for the IML extension file to load the project structure configuration again (for example app.iml), and thats all. I hope it helps.
Kip2's solution worked for me with a slight variation:
1.) File -> Invalidate Cached/Restart..
once android studio restarts:
2.) File -> Sync Project with Gradle Files
Just doing "File -> Sync Project with Gradle Files" (or doing "File -> Sync with File System"), did not correct the problem. I had to invalid the cache first, and then sync the project with gradle files for the project to display properly.
Finally find solution.
Whenever Android Studio starts, it search for "Gradle" installation. If not found, it will download new version of it and cache it here.
C:\Documents and Settings\user\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok
Here 72srdo3a5eb3bic159kar72vok directory name may be different.
What you need to do is, download gradle-1.6-bin.zip, place it in above directory. Then decompress it there. But make sure your path should like below.
C:\Documents and Settings\crathod.SOLUSOFTINDIA\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\gradle-1.6\bin
Now, when you restart your Android Studio, Gradle will be initialized and Project will opened in Full Project Structure.
Modules or the project structure could also not appear because you're in a branch where *.iml files are missing. This happened for me when I was migrating from Eclipse and had decided to check back into the original branch that had the Eclipse-like project structure. What solved my problem:
Checkout the branch with Android Studio-like project structure
File -> Invalidate Cache & Restart
Also, make sure that the root iml file matches case with your root folder. Incorrectly named iml file will cause such problems.
Just delete the root iml file (you can backup if you like), close the project and re-open it. Android Studio will generate the correct iml file and the project structure will be restored.
This is tested on Android Studio 2.1
Before:
  
After:
  
  I got the java folder (src folder) and others.
Solution:
  
File > Sync Project with Gradle Files
Android Studio Version: 3.2.1
Note: This case did not appear on the old version. For example, 1.5.1 (2016/03 before)
Keywords:
file explorer
file structure
file hierarchy
file system
folder & file list
project explorer
project structure
project hierarchy
disappear / gone / did not see
Android Studio bug / issue
simple way to restore
Delete the project hidden .idea file and .gradle file and restart your project this will fix your issue.
I deleted the app from the list of apps when you open Android Studio, then I reimported the project.
For Android Studio 2.2, you can simply click the left bottom and then select Project
In Android Studio 2.3.1, you don't have the Application module option if you wanted to add a module. The best solution is to right click your project and select "Jump to the source" from the menu. That solved my issue.

Android Development - Conversion to Dalvik format failed with error 1

So I'm dipping my toes into this area for the first time - i followed instructions to install the android SDK and eclipse plug in. I created a blank new android project and I get the following build errors:
[2011-01-08 16:34:55 - xxx]: Dxno classfiles specified
[2011-01-08 16:34:55 - xxx] Conversion to Dalvik format failed with error 1
I've googled the problem and tried to clean and rebuild, or hitting F5 on the project in the explorer but the issue remains. I've verified the build paths and the libraries to make sure only Android 2.3 is there but still get this issue.
I have also tried to load a sample project and I get the same error.
Any ideas?
This problem happens when the java files in the Eclipse project are not compiled to class files. The message indicates that the Android SDK cannot proceed to convert these classes to dalvik format because it could not find them. To solve this problem:
Verify that the src folder is in your build path ( check under "Project Properties" -> "Java build path" ). If this is not the case right-click on the src folder, go to "Build path" and click on "Use as source folder".
Verify that under "Project properties" -> "Builders" you can find "Java builder". If this is not the case close the project and with a text editor open the file .project present in the root folder of the project itself. Add under <buildSpec> the following lines:
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
</buildCommand>
After performing the actions described above, re-open the project and proceed to rebuild it by clicking on "Project" -> "Clean"
I fixed this - none of the above helped.
What i did was delete eclipse, download the latest one and reinstalled the ADT plugin and it works now.
Simply edit the "project.properties" file and comment the line:
proguard.config=proguard.cfg
to be like the following:
#proguard.config=proguard.cfg
then clean the project. Hope this will export to APK successfully.
The answer is detailed here. Try these steps, and it should work out.
I had the same problem: try to clean the project (Project -> Clean...). Eclipse will recreate the right bin directory.

Categories

Resources