android studio 3.1.1 not reflecting changes in apk - android-studio

I have read at least 5 responses to this but none has worked so far... In windows 10, Android studio 3.1.1 (the latestest version, april 2018) I have an app which I have made some changes in but that changes do not deploy in the AVD. The bugs listed that it's supposed to have been corrected for this version persist, and none of the solutions for this problem I have found worked. Could anyone Help me solve this somehow? I have spent days in this... Thanks.
By the way, the app I have to modify is in react-native.

Firstly, please try cleaning your project and building the app. To achieve this, please click in menu bar Build and choose Clean project. Then go to Build tab again and click Rebuild project.
Also, please try to restart your AVD.
Optionally, go into settings of your AVD and uninstall your app manually. Then click play button and choose your AVD to run your app on this AVD.
If the problem persist please provide more info. Especially please give us more info if you are using gradle build tools, if yes then what info does the gradle console give you, etc.
Ok, if you are sure none of above work, please tell me if your changes are reflected on another, possibly new AVD?
Do you have a chance to try your app on real device connected to your computer in debug mode (Developer Tools active, computer trusted and usb debugging allowed)? Do you see changes in your app on device?
Let's give another try to something like this: please open build.gradle file, then make some slight change in it (like add some space). Android Studio should notice change in gradle file so it will prompt you with yellow bar above with option: Sync Now. Does your app reflect changes after that?
And lastly, are you sure your changes are not reflected? Can you add something logging to Logcat (i.e. Log.d("test", "this should print in logcat debug level.."); ).
Another edit, have you tried this?
Open MainApplication.java in the android/app/src/main/java/{packagename} directory, delete the following code if exist:
import com.facebook.react.BuildConfig;

Related

Flutter not building app without error at all

My Flutter project was working just fine. I lost my Internet connection for a bit and when it came back I got a pop up talking about an Android Configuration found for the project, I clicked Add, then it started showing me two Device slots on the Upper tab where it shows what devices are connected.
Now if I need to run my app on my device, Flutter simply tries to run the project, then stops without any output in the Run Tab of Android Studio. This is really giving me a headache... I wish it gave an error or something. Someone please help me so i can resume development.
if you have not changed anything in the android directory the easiest thing to do is to delete it, then run in the terminal
flutter create .
if you have changed a lot of things in the android you can copy your changes and do the same or can go an revert the gradle configurations manually.

Android Studio waiting for build to finish (activity_home_drawer.xml)

I've started to work with Android Studio. I tried to open activity_home_drawer.xml file, but I can only see
waiting for build to finish..
Can any one help me?
I already tried clean project and re build, but not success I had tried in so many ways what are explained in other StackOverflow question. but I still can't find a solution for this.
Gradle needs to re-sync. Go do gradle and make some changes, e.x add comment. There will be a yellow Sync now button on right corner. Click on that, it should fix it

Indexing freeze with message: Indexing paused due to batch updated

I've updated Android Studio to version 3.2.
After that update one of my projects don't want to index.
It freezes with the message
"Indexing paused due to batch update".
How can I fix this?
File gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
File gradle-properties:
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true
I faced the same issue with Android Studio 3.2. Invalidated the cache and restarted Android Studio, but it still did not work for me. Then I just re-imported the project and it worked!
Just Restart (File > Invalidate Cache & Restart > Just Restart)
I faced this issue in Android Studio 3.+ when forcefully close Studio in between some gradle process.
Pressing the play button worked for me. It finished indexing and installed the apk in seconds. The catch is that I have to do this every time and batch does not seem to update.
Click on the play button to the right of the progress bar.
Press the play button to the right of this message and the issue would resolve.
You have to do it every time, because right now the problem is systematic and there is no solution to stop it from appearing.
I invalidated the cache and restarted Android Studio. That worked for me.
You can do this by:
File > Invalidate Caches / Restart > Invalidate and Restart
I faced this issue many times and what I did everytime is:
Firstly, click on the processing bar on the bottom of the android studio.
A pop up window will appear on the screen like this-
Click on the red circled Play button and let the process complete.
Please note that you will have to repeat this everytime you face this issue because this is some kind of bug or something in AS version 3.2
Optional: click on (-) minimize button if you want to the pop-up to minimize
I faced the same issue, it seems that Android Studio messes up the cache.
Go to File > Invalidate Caches and Restart
Then on the Pop Up that appears choose Invalidate and Restart
Seems like there is an issue with Android Studio itself. I fixed the issue for now by following these steps:
Click File > Invalidate Caches / Restart
On the pop up choose Invalidate and Restart
Invalidated the cache -> restarted Android Studio -> re-import the project from the project location. Its worked for me
This is an issue in Android Studio since v3.2, I have posted an issue in Android Studio Issue Tracker, it's being finally accepted. Waiting for them to solve it.
Here is the issue tracker, you can follow up from here.
please star the issue as well to help solving it.
Stay Connected to internet.Let the batch to be updated.Wait one time and it will be easy the next time. OR...Click on the play button.
I saw this error and none of the solutions posted here worked for me. I had a specific scenario (see below), and I could get rid of the problem in my specific scenario. Not sure if the OP had the same scenario, by here are my two cents:
In my specific case I had two projects open in Android Studio, where one of the project was from a sshfs-mounted directory (the other project was local to my computer). I believe that made Android Studio throw the "Indexing paused due to batch updated" message on, strangely, both the projects.
To get rid of the error on the local project, I had to close the remote mounted project. On closing that project, the message was gone for my local project.
Hope that helps.
Close your project
Go to your project root directory,
Find and delete the xxx.iml file, the .idea and .gradle folders
Re-open your project using Android Studio.
I had the same issue and I fixed by do the following:
Click File --> click on Invalidate Caches / Restart
You will see a pop up--> select Invalidate and Restart
I did it by exporting the project into zip file and open it like normal. you can export by clicking the file navbar and choose export to zip file
I faced the same Issue but the situation which lead to this was different:
I created a remote branch on the project's repository on GitHub and it was empty.
And then I checkout to that branch locally while android studio was running.
I then deleted the local repository and created it again but this time it was not empty. Further I pushed the code to the remote branch as well.Now I thought that it will start the project normally but again the same happened.it resulted in an IDE error.
To solves this issue I deleted that local repository and again re-imported it.Than it started correctly.
None of the other answers worked for me. Not even pressing the "play" button. All that worked was closing the project and re-opening it via "Open an existing Android Studio project".
The effect only lasts for a single session. As soon as I close and re-open the project, or AS 3.3, the problem re-appears.
Deleting C:\Users\<user>\.AndroidStudio3.3\config\options\recentProjects.xml (before starting AS 3.3) is an alternative way to accomplish the same thing.
EDIT
Upon upgrading to AS 3.3.2, this solution no longer worked. However, after an "Invalidate Caches and Restart", the problem disappeared.
Click on play button twice and then go to file->Invalidate Caches / Restart...
repeat this process every time whenever you face this issue.
I solved it by deleting all the *.iml files and the .idea folder
I faced the same issue, because my AS version is not the same with gradle plugin's version.
This issue coccus randomly in Android Studio V3.+ [Issue tracker:https://issuetracker.google.com/issues/118523471] .
There might be multiple reasons for this issue but it is mainly either ".gradle" related or ".iml" file related IntelliJ/Android Studio configurations.
Possible solutions:
Click on play icon under the processing bar (on the bottom of the android studio). But be aware that multiple clicks may also kill the the indexing process.
Invalidate cache (File -> Invalidate Cache & Restart -> Just Restart)
Clean ((Build -> Clean project) and Rebuild (Build -> Rebuild Project)
Sync Project with Gradle Files: Available options (depending on the Android Studio version) at
Tools -> Android -> Sync Project with Gradle Files
button available at top left corner in Android Studio's toolbar
File -> Sync Project with Gradle Files
Delete the .idea & .gradle folders and .idea & .iml files from the project root directory and re-import the project
I have faced this issue quite a few times and got rid of then by using one or more of above solutions.
But in some scenario nothing of the above solutions may work (as recently I get trapped-in). In this case I have to recreate the same project from scratch and copied back the required files into it. But ideally this should not be the solution. Please let me know if any other possible solution is there.
Invalidate cache and restart did the work for me. Now, the build is compiling in seconds.

Android Studio is installing old apk on device

I am developing an Android app using Android Studio (0.89 Build #AI-135.1404660, Built on Sept 3,2014) using both emulator and Nexus 4 device.
I had the same issue with a version prior to that.
The problem is that after I changed my code and resource files, I still get the old apk installed on the device or emulator.
What do I need to do to get it to run current code? Is it a building config?
Is it a known issue with Android Studio?
Or with a Nexus 4 device?
This is the second time it has happened, and I resolved it(then) after trying one of the steps below. They have not worked for me again.
Here is what I've tried
Build > Clean Project > Restart Android Studio > Run
Build > Rebuild Project > Run
Step 1 plus Uninstalling of apk on device
Step 2 plus Unistalling of apk on device
Adding erroneous resource entry then running.
I have read the following:
Android apk install: How to clear files from old version?
adb - How to reinstall an app, without retaining the data?
Device still has the old apk
Android build doesn't update code base or resources for target .apk on device
None has worked so far.
I had the same problem. After trying numerous methods that didn't work, I realized that I had accidentally changed an option in my "Run Configuration". Here's exactly what I did to fix the issue.
Run --> Edit Configurations
With your configuration selected on the left panel (mine says "app"), in the General tab on the right panel, there is a section called "Before launch". This section should have an option added called "Gradle-aware Make", but I had accidentally removed it.
I re-added it by pressing the "+", then clicking OK in the popup (leave the input box in the popup blank).
Click apply.
This fixed the problem immediately. Hope this helps someone!
Run / Debug Configurations / Miscellaneous TAB
[] Uncheck: Skip installation if APK has not changed
Android Studio doesn't always detect small changes in code.
The behaviour is erratic. I solved it by reviewing my code.It turned out that there was a resource file that was invalid. Try reverting back to the last working version of your code before the current changes... Probably a known issue that will be/was resolved out of Beta
Google thinks it is a feature, not a bug
https://code.google.com/p/android/issues/detail?id=156263
Their proposed solution is to copy the apk(s) instead of manipulating the filename, as in e.g.
Copying APK file in Android Gradle project
I've spent way too many hours to keep this to myself. The way I fixed it was that I noticed some hours later that I was using different layout version in res/ .... I have actually two versions of layout (layout-v26) and (layout). All this time I was modifying the other one and uploading different one. Maybe its just a newbie mistake but I hope somebody will find it useful.
The reason why there are 2 version was because of " autofillHints="" -> quickfix -> create new version of layout "
image of my tree
I am using android studio for building flutter app, I was facing the same issue untill I did the following:
From Android Studio, go to Tools-Flutter-FlutterClean
It resolved my problem as of now.
Check Your Layout Files.
I ran into the same problem and I realized, it gives some problem if you have same layout in multiple orientations(portrait and landscape). If one is changed other remains unchanged and then it creates a conflict. So android studio installs the one with the previous layout
PS: This was happening in my case.
The problem occurred on my Android 11 devices. I guess ART ran old code dex2oated.
Solution:
Run / Debug Configurations - General - Always install with package manager (disable deploy optimization on Android 11 and later), and check the option.
I was also facing this issue and get solution by deleting build folder manually because some time ide cannot be able to delete this. So go to the app folder and find build folder delete this and after clean and build project and run again.
projectname->app->build
You should select "Deploy default APK" option in Run/Debug Configurations. After that Android Studio will upload and install new apk to your emulator/device when you run application.
In android studio. at right side. see gradle option. click it. and then press circular arrows button shown in red square.
Same problem, none of the solutions mentioned here had any effect. I had to disable the "Allow parallel run" in "Menu > Run > Edit configurations...".
You can read more about this option here: How to run the same project multiple times in IntelliJ IDEA?
The solution to this issue is actually very simple.
Android studio is actually not detecting some small changes that you have made to the application. That is why it is installing the previous builds.
The solution is easy -> Remove the previous builds.
In the right side, go to gradle tab.
Expand Tasks. Find "clean" or "cleanCache" task or any task that starts with "clean". Double click to run that task.
Expand "app". and do the same.
Then File> Invalidate cache and restart.
Enjoy!! Your problem is solved...
My devices also ran old states - dont know from where in my git it has taken these.
I created a new configuration (default is "app") and it worked.

Android Studio: "Update & Restart" doesn't work

Every morning after start of Android Studio I became a dialog with information about new version of Android Studio (Beta). If I click on "Update & Restart" the patch will be downloaded (I see the progress bar and the growing file size). After that the Android Studio will be restarted but... the update is not installed! I can repeat it if I click on "Help/Check for update".
Has anybody an idea how to fix this?
P.S. Sure it is possible to download the full version and install it manually, but it would be so convenient to use automatically updates.
I've solved the problem. It is important how Android Studio was started. If I start it with a workspace parameter:
/android-studio/bin/studio.sh /<path_to_workspace>
then the update doesn't work.
So the solution is to start the Android Studio without any parameters.
I successfully updated my AS from 2.1.1 to 2.2.2, by the following way:
File > Close Project. Close AS.
restart AS, it will not open any project and show you a project list, but please don't open any project.
wait for AS to popup a dialog to remind you there is a new version.
click "update & restart".
after restart, it may remind you import previous configuration files.
import configuration, open a project, you will see the new version number.
hope this will help.
I actually created the issue and it seems they fixed it in the latest release and you have to download it manually from here and update mechanism should be fine.
Ah, it happened to me just now.
In case you installed the Android Studio via JetBrain's Toolbox then the button is disabled if you start the AS manually. You need to close the AS and open the Toolbox and then update from there.

Resources