2) Also you can try enabling "offline work" in android studio, like suggested here, that makes sense. This will not refetch libraries every time you make a build. Perhaps slow connection or proxy/vpn usage with "offline work" disabled may lead to slow build times.
I tried creating a new android project in local storage and copied all my files from the previous project into the new one - java, res, manifest, gradle app and gradle project (with latest gradle classpath dependency). And now I can build on my phone in less than 15 seconds.
I sometimes face this problem.This solution is a problem solver for me. So try in Once.first, be sure of your proxy connection.second, Remove cash and indexes for all projects. For this, you need to proceed through the following address.file -> invalidate Cashes then tick all optional items then select Invalidate and Restart Buttonthen restart android studio and rebuild your app.I hope it is useful.
i know these specs are slow but i have seen many people using same android studio version on core 2 duo 4GB RAM and core i3 4GB RAM. and their gradle is taking 2-3 minutes for the first time build and then less than 30 seconds for each build can you please tell me what is wrong with my android studio? or what kind of settings i can do to make it better?
Mine still takes forever. I'm going to post a question about the best way to download Gradle, I tried using Homebrew's version but long story, couldn't get it to work. Downloaded version 2.1 from their site but then Android Studio was complaining about wanting version 1.1.... Now it just takes forever to start a project :(
Many times when we are building any application or running it on our device or emulator. We will get to see that Gradle connects with our internet and downloads the files from the internet. This process sometimes takes so much time which will depend on your internet connection. So to avoid downloading these files we have to enable offline mode for our android studio for Gradle files to avoid downloading of these files. Below are the steps in which we will be enabling offline mode in our application. Click on the File option which is shown in the top bar of Android Studio. Inside that click on the Settings option. You can get to see the Settings option in the below screen.
After clicking on the settings option you will get to see the below dialog. Inside this dialog navigate to the Build, Execution, Deployment option and then click on the Gradle option. After that uncheck the option for Download external annotations and dependencies and after that click on Apply option and then click on the OK option to proceed further. After that we have enabled offline mode for Gradle has been enabled in our android studio project. Now due to offline mode, the loading time for your Gradle will be reduced to a certain extent.
When we add many dependencies in our Android Studio project it will take much time to compile your android studio project and also manages all the dependencies in your android studio project. As the Gradle file manages all the dependencies of our project so we should use fewer number dependencies which will help us to reduce the time required for the Gradle to sync each time when we create a new apk or run our application in an emulator or device.
I believe it's not my project files acting up because I can run android studio (3.4.1) normally on my laptop (win 10), and not my PC because other programs can run normally. FYI I am regularly maintaining my PC like CCleaning, defrag, SMART check, virus scan, malware scan, etc, and I have i3-4310 with 8GB RAM. So what can I do to fix this? I have tried re-install the Android Studio but no success.
If you need to customize the build.gradle file, rather than edit it directly, it is recommended to create a sibling file named build-extras.gradle. This file will be included by the main build.gradle script when present. This file must be placed in the app folder of the Android's platform directory (/platforms/android/app). It is recommended to use the before_build hook script to copy this file over.
There is one additional factor in the example above that only applies in the second-discussed situation (i.e. when a plugin launches an external activity). Not only was the state of the application lost when the user finished taking a photo, but so was the photo that the user took. Normally, that photo would be delivered to your application through the callback that was registered with the camera plugin. However, when the Webview was destroyed that callback was lost forever. Luckily, cordova-android 5.1.0 and above provide a means for getting the result of that plugin call when your application resumes.
In order for the Google Play Store to accept updated AAB/APK, the android/app/build.gradle file will need to be edited to increment the versionCode value, then rebuild the app for release following the instructions above.
df19127ead