I have a LibGDX project which is made up of a core project and multiple Android/desktop projects which are dependent upon it.
I'm currently changing some code in the core project but upon manually building, cleaning, and running the changes are not being reflected when I run the project.
From my searching I feel the issue is related to Instant Run, but I cannot disable it as the checkboxes are grayed out.
Is my issue related to Instant Run? And how would I go about disabling it?
it seems you need a successful build with gradle (at least up to the configuration phase) and then the checkbox gets editable.
On a new installation of Android Studio 3.0.1, I found that I couldn't build a project because of Instant Run and that the Enable Instant Run was forced on and greyed out so that it couldn't be disabled.
The build error was:
Error:Failed to notify project evaluation listener.
I found that doing a build from the command line fixed both the failure to build and not being able to disable Instant Run.
./gradlew assembleDebug
Make sure you change the Instant Run setting in a specific project.
I mean you need to do:
Open the specific project
Right click on the file
choose settings
Build
Instant run
For me its work
Related
I have updated my android studio to new stable version 3.1.
After build project not able to run.
Let me know if anyone have face same issue or find any solution.
Just go to "Run/edit configurations.../" and scroll down to bottom of the window and here you see an option "Before launch..."
First, remove whatever already inside the little window and then click on (+) icon and select "Gradle-aware Make" and then type "assembleDebug" and select the first option or that you need. This will solve your problem.
Try deleting both your build folders in your project manually and rebuild. This usually happens when you update gradle version, in my experience.
The solution that worked for me was a combination of other answers here.
I had upgraded to the most recent stable version of Android Studio at the time, 3.1. Along with that, Android Studio prompted a dialog asking me if I wanted to upgrade my Gradle from 3.x to 4.4, and I accepted as well.
After that I got the error of this question, and then I did this:
Open menu Run -> Edit configurations...
In the Before launch: section, select any options you have listed (each option has the Android symbol), and remove them with the - symbol
Add the option Gradle-aware Make, with the value assembleDebug
Clean and rebuild your whole project
just clean and rebuild your project
I had the same problem. I change in build.gradle 'compile' with 'implementation', then clean and rebuild the project. Now it starts with no problem.
Run "Build-> Clean Project" normally will fix this problem.
When I try to install an app, there are two possibilities:
Install existing APK from build folder when I run the app
Install APK after performing clean build
For existing APK in the build folder, the app just works fine. But when I clean the project using Build -> Clean Project, and then try to run the app (i.e. install the app to my emulator or physical device), it shows me error:
The APK file /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not exist on disk.
NOTE: This behaviour happens only when I clean the project and not when I have already have a pre-built app APK in my build folder
I've referred to: The APK file does not exist on disk but my point is, when we usually run the app after cleaning the project, we never need to make a build of it, if the APK is not existing in the build folder, it automatically generates and installs the latest one.
Things I've tried:
Running the app when APK file exists in the build folder (works perfectly fine)
Running the Clean Project -> Running the app (expected is the project would be built and the app would get installed but it shows the above mentioned error!)
Same process of cleaning and running the app after doing Invalidate Caches/Restart
I have solution for your issue.
Also confirmed by Android Studio on Twitter : https://twitter.com/androidstudio/status/981914632892960768
Edit your app configuration as below.
Here you can see your app configuration as below.
Here is missing Gradle-aware make attribute in before launch configuration. You can see here.
Please add this Gradle-aware Make attribute through this way. Click on + icon and select Gradle-aware Make as seen in this screen.
You can add this without writing any task just press OK button and task will be added and now it should look like this. Now apply changes and run your application.
It will solve this old apk installing issue on clean build in new Android Studio 3.1 issue.
Note : This issue is resolved in new Android Studio 3.1.1 Stable release.
The APK file
/Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not
exist on disk.
May be bug. You should change Settings.
You should open the Run/Debug Configurations dialog & select Run > Edit Configurations
Make sure, Gradle-aware Make is Added in TaskList or not. If not then click + & select from the options.
Note
If you receive
Shutdown finished in 0ms Error while generating dependencies split APK
com.android.ide.common.process.ProcessException: Failed to execute
aapt at
com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
at
com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797)
at
com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApkResourcesAp(InstantRunSplitApkBuilder.java:373)
You should Un-Check INSTANT RUN.
File-- Settings-- Build, Execution, Deployment -- Instant Run and
uncheck Enable Instant Run.
clean your project and run again
If it's not work then
Step 1 Close your project.
Step 2 Go to your project folder and delete all build folder.
Step 3 run your project.
This issue has been fixed with Android studio 3.1.1 (April 2018) release.
Update your android studio to 3.1.1.
Here is there explanation regrading the issue details, cause and solution:
In some cases, when a project created in Android Studio 3.0 was opened for the first time in Android Studio 3.1, the Gradle-aware Make task was removed from the Before launch area in Run/Debug Configurations. The result was that projects did not build when the Run or Debug button was clicked, which in turn caused failures such as deployment of incorrect APKs and crashes when using Instant Run.
To solve this problem, Android Studio 3.1.1 adds the Gradle-aware Make task to the run configuration for projects that are missing this entry. This modification occurs after the first Gradle sync when the project is loaded.
Official release notes: https://developer.android.com/studio/releases/index.html#3-1-0
For all people seing this and having the issue on Android Studio +4.0.0:
Run -> Edit configurations... -> disable check box (Allow parallel run)
It may slow your build a little but it better than running the app more than one time.
When I try to install an app, there are two possibilities:
Install existing APK from build folder when I run the app
Install APK after performing clean build
For existing APK in the build folder, the app just works fine. But when I clean the project using Build -> Clean Project, and then try to run the app (i.e. install the app to my emulator or physical device), it shows me error:
The APK file /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not exist on disk.
NOTE: This behaviour happens only when I clean the project and not when I have already have a pre-built app APK in my build folder
I've referred to: The APK file does not exist on disk but my point is, when we usually run the app after cleaning the project, we never need to make a build of it, if the APK is not existing in the build folder, it automatically generates and installs the latest one.
Things I've tried:
Running the app when APK file exists in the build folder (works perfectly fine)
Running the Clean Project -> Running the app (expected is the project would be built and the app would get installed but it shows the above mentioned error!)
Same process of cleaning and running the app after doing Invalidate Caches/Restart
I have solution for your issue.
Also confirmed by Android Studio on Twitter : https://twitter.com/androidstudio/status/981914632892960768
Edit your app configuration as below.
Here you can see your app configuration as below.
Here is missing Gradle-aware make attribute in before launch configuration. You can see here.
Please add this Gradle-aware Make attribute through this way. Click on + icon and select Gradle-aware Make as seen in this screen.
You can add this without writing any task just press OK button and task will be added and now it should look like this. Now apply changes and run your application.
It will solve this old apk installing issue on clean build in new Android Studio 3.1 issue.
Note : This issue is resolved in new Android Studio 3.1.1 Stable release.
The APK file
/Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not
exist on disk.
May be bug. You should change Settings.
You should open the Run/Debug Configurations dialog & select Run > Edit Configurations
Make sure, Gradle-aware Make is Added in TaskList or not. If not then click + & select from the options.
Note
If you receive
Shutdown finished in 0ms Error while generating dependencies split APK
com.android.ide.common.process.ProcessException: Failed to execute
aapt at
com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
at
com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797)
at
com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApkResourcesAp(InstantRunSplitApkBuilder.java:373)
You should Un-Check INSTANT RUN.
File-- Settings-- Build, Execution, Deployment -- Instant Run and
uncheck Enable Instant Run.
clean your project and run again
If it's not work then
Step 1 Close your project.
Step 2 Go to your project folder and delete all build folder.
Step 3 run your project.
This issue has been fixed with Android studio 3.1.1 (April 2018) release.
Update your android studio to 3.1.1.
Here is there explanation regrading the issue details, cause and solution:
In some cases, when a project created in Android Studio 3.0 was opened for the first time in Android Studio 3.1, the Gradle-aware Make task was removed from the Before launch area in Run/Debug Configurations. The result was that projects did not build when the Run or Debug button was clicked, which in turn caused failures such as deployment of incorrect APKs and crashes when using Instant Run.
To solve this problem, Android Studio 3.1.1 adds the Gradle-aware Make task to the run configuration for projects that are missing this entry. This modification occurs after the first Gradle sync when the project is loaded.
Official release notes: https://developer.android.com/studio/releases/index.html#3-1-0
For all people seing this and having the issue on Android Studio +4.0.0:
Run -> Edit configurations... -> disable check box (Allow parallel run)
It may slow your build a little but it better than running the app more than one time.
I've updated to Android Studio 3.0 and now I cannot run the app with Instant Run enabled.
I get 'Execution failed for task' due to a java.io.FileNotFoundException because it can't find the apk under
../build/intermediates/instant-run-resources/resources-production/
Any idea how to overcome this so that I can run the project with Instant Run?
I'm not sure where to find the missing apk file or how to change the path to look for it in.
Have your settings as below,
Otherwise try to clean and re-install (after uninstalling exsisting apk) application.
I found the problem and the solution.
In my case the cause was dexcount-gradle-plugin. The plugin is expecting that the package task produces an APK, but that is not true anymore on Instant Run. So they released a new version that disables the process when running with Instant Run.
So I just had to update dexcount to the latest version.
Configure your project for Instant Run
Android Studio enables Instant Run by default for projects built using Android plugin for Gradle 2.3.0 and higher.
Please checkout this LINK to configure your project for instant run.
"Make Project" in Android Studio doesn't build an apk file for me since I upgraded to 0.5.3. Does anyone know how I can make it do so?
I have updated buildToolsVersion to 19.0.3, which is the latest version.
(Every time Android Studio updates it creates another problem like this, I'm sorry but I'm not an expert on build systems, I scarcely even have any idea what kind of voodoo is involved in building a project).
Thanks.
You need to now run an assemble gradle task to make the apk. Here is a post on Google+ in "Android Developer Tools" community on the subject (By Alex Ruiz).
"Build > Make" behavior changes.
In the next version of Android Studio (0.5.3,) we have changed the behavior of the "Build > "Make" menus. Instead of invoking "assemble" Gradle tasks, now they only compile Java code (generating R.java if necessary,) similar to Eclipse ADT's behavior. This change will speed up development workflows (pre-dex, dex, packaging, etc. will be executed only when running/debugging an app or when exporting an APK.)
As a side effect the menu "Build > Compile" has been removed, since it is now redundant.
The "Make" button in Android Studio now runs the gradle android plugin task "compileDebugJava". In order to build the APK file, it needs to run the task "assembleDebug". I'm not sure what the rationale was for changing the behaviour of the button, or how to change it back. The only easy way (i.e. not using the command line) to get the assembleDebug task to run is to have a run configuration which runs a "Gradle-aware Make" before launch. The "gradle-aware Make" is simply the assembleDebug task.
I preferred the old behaviour, but of course, Google knows best.
Edit: I know nobody cares, but I worked around this by adding gradlew to Android Studio as an external tool, with the command line option "assembleDebug" and then adding a custom button to the toolbar to run this external tool. I now use this button instead of the Make Project button as it does what I would like to do (build an APK).
Here is a simple way to build the APK file:
Open the Gradle Tool window. To find that window, use Help->Find Action, type "Gradle" and select "Gradle" in the "Tool Windows" category;
Double-click "assembleDebug" to build the APK.
Or better: right-click "assembleDebug" and choose "Create...", so that this task will be saved for future usage in the configurations menu that appear on the main toolbar.