This question already has answers here:
Android Studio 3.1 "Run" not compiling code
(5 answers)
Closed 4 years ago.
This is very annoying aspect of the new android studio version 3.1, I used to launch run command after every code changes, the IDE rebuilds the (whole project & APK) and then deploys it on the target device.
Then after upgrading to version 3.1, the run command does not rebuild the apk any more, and displays the following error messages.
android studio 3.1 Session 'app': Error Installing APK
android studio 3.1 The APK file Error while Installing APK
so I have click on" rebuild & run" each time I make code modification, how can I restore the old behavior of version 3.0.1
Go to Run -> Edit configurations. And then make sure you have Gradle-aware Make option like below screenshot.
If not then click + and select from the
More update in twitter regarding this:https://twitter.com/androidstudio/status/981914632892960768
disable the instant run option.
Open Settings from File > Settings
Navigate to Build,Execution,Deployment > Instant Run
Uncheck the enable instant run check box
Related
This question already has answers here:
Cannot enable Gradle's offline mode on Android Studio 3.6
(10 answers)
Closed 2 years ago.
I updated my Android Studio application to the latest version on Mac to Android Studio 3.6, Build: #AI-192.7142.36.36.6200805
I saw the option to enable offline mode(in the Build output area or so) when the build failed due to Internet connection problems and I did so by clicking the supplied link.
Later on, I needed to disable offline mode and I followed the normal steps:
Go to Preferences > Build, Execution, Deployment > Gradle.
But on the Gradle option in this very build, there was no Check the Offline work checkbox
My question is:
How do I disable offline mode under the newest build of Android Studio?
The Same answer as above but in pictures.
Look at the right side of the Android studio, you will see gradle tab. Click on it.
If you cannot see gradle tab then
This question already has answers here:
Android studio isn't opening on Windows
(28 answers)
Closed 1 year ago.
After I close out the Android Studio tab, I am not able to open it again. I am not able to open Android Studio until I uninstall and reinstall the software. Every once in a while, the screen will go gray and I am forced to reinstall again.
I have tried right clicking and selecting 'open', but it doesn't do anything.
I expected Android Studio to open after clicking on it, but it is as though I never installed it at all. It only works until I close the tab.
Update:
I went into my files and clicked on one called 'Studio'. It gave me an error titled Error launching Studio. Here is what it said:
Failed to load JVM DLL C:\Program Files\Android\Android Studio1\jre\jre\bin\server\jvm.dll
If you already have a 32-bit JDK installed, define a JAVA_HOME variable in Computer
> System Properties > System Settings > Environment Variables.
Remove the cache files from user-> appdata-> android studio
On Windows: %USER_HOME%.gradle/caches/
Use your uninstaller to remove all the cache, registry, files, temp then restart install new version of android studio to different location.
I was having a problem with Android Studio a few weeks ago when my antivirus was removing a file needed to launch the app on my device.
I had to re-add the library file that it would keep removing before I caught that it was proudly telling me that it was removing that file to quarantine.
Long story short check that your antivirus is not removing the file.
I was able to resolve the same issue by refer to the solution provided in Android Developer Portal,
Studio doesn't start after upgrade
If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin. As a workaround, try deleting (or renaming, for backup purposes) the directory below, depending on the Android Studio version and operating system, and start Android Studio again. This will reset Android Studio to its default state, with all third-party plugins removed.
For Android Studio 4.1 and later:
Windows: %APPDATA%\Google\AndroidStudio
Example: C:\Users\your_user_name\AppData\Roaming\Google\AndroidStudio4.1
macOS: ~/Library/Application Support/Google/AndroidStudio
Example: ~/Library/Application Support/Google/AndroidStudio4.1
Linux: ~/.config/Google/AndroidStudio and ~/.local/share/Google/AndroidStudio
Example: ~/.config/Google/AndroidStudio4.1 and ~/.local/share/Google/AndroidStudio4.1
This question already has answers here:
Android Studio 3.3 Stuck at Project Setup:reading from cache
(4 answers)
Closed 2 years ago.
When i compile the Project and Run on the device than it's working fine and i checked the app in real device by USB Cable and it's running perfect but when i try to generate the release apk or try to generate the debug apk than it show The Error that gradle sync faild can not generate the apk and shows the warning/Error as
Android Studio 3.0.1 Error: Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
try this
go to Android Studio > Preferences > Gradle
then pass the proxy details as VM options.
-Dhttp.proxyHost=www.somehost.org -Dhttp.proxyPort=8080
I added this from using this AndroidStudio gradle proxy solution
If you want the apk immediately, then go to the project directory and run the following command in your terminal.
find . -name '*.apk'
you should be able to get your apk file path in your directory. That would be a debug apk which got created when you compiled your project and ran on the device. You can share that.
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.