'Android Studio is not detecting code changes on Run 'app'
Solved! I am new to Android Java programming. Trying to make a simple app. All went smoothly until windows crashed and something happened to Android Studio.
Everything was OK untill windows crashed.
I turned on windows, ran Android Studio and the first thing happened is that all the tabs were closed, I thought it was OK and reopened them, kept writing code and then started the app through the Physical device (as usual and as all the time I did it) and noticed that what I did to the code did not displayed in my app.
Example:
TextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//TextView.setText("Test1");
TextView.setText("Test4");
}
});
If I ran the app I will get after clicking "Test4"
BUT!
If I change the code to:
TextView.setText("Test1");
//TextView.setText("Test4");
And press the Run 'app' (Shift + F10) - no problems AS found!
And the result I got is still, after clicking, "Test4"!!! No matter how I change the code I will get "Test4" after clicking, even if I completely delete the OnClickListener!
Changes applied irregularly and if I change .xml and then .java or vise verse - and that's on a rare cases!
I can change any Java or xml file and there wouldn't be any changes in the running app.
What the steps I have already tried and it did not help: 1.1. Checking that I am working on the right tab and the right document!
Restarting everything!
Deleting the app with its data and rebuild it
Starting a new project - even in new Project with new code same thing!
Build --> Rebuild Project
Invalidate Caches/Restart
remove folder 'projectname/app/build'. Temporary file build.
enable/disable 'Power Save Mode'
Before launch Gradle-aware Make
Sync Project with Gradle files - worked only once
Skip installation if APK has not changed
Instant Run I hope is turned OFF because there is no such thing in my AS
Updating/Uninstalling/New installing Android Studio
Deleting/Redowloading and installing SDK
I think that's all, will add if I recall something.
Thank you for help!!!
P.S. Android Studio Bumblebee | 2021.1.1 Patch 3 Build #AI-211.7628.21.2111.8309675, built on March 16, 2022 Runtime version: 11.0.11+9-b60-7590822 amd64 VM: OpenJDK 64-Bit Server VM by Oracle Corporation Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 4 Registry: external.system.auto.import.disabled=true
P.P.S. After a few days of researching Found a solution, hoping it may help someone who tried everything but this: Run --> Edit configurations --> CHECK the "Always install with package manager (bla-bla-bla)". Worked for me, hoping it will help you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|