I have very frustrating problem and can't deal with it.
It seems like I clicked something what unlocked my UI and it's getting crazy every time I restart Eclipse and launch app from Package Explorer.
Symptoms:
- every time I restart app whole perspective is hidden
- after running app, when I click on class perspective its hiding again
I tried to reset to defaults and deleting .metadata but it didn't help.
Cheers :)
Related
I am completely new to Andoid Studio, Java, and app development in general.
With that, in order to learn, I downloaded Android Studio version 2.3. And, for my first project, I imported the accelerometer example from the sensors library. I opened it, poked around, didn't change/save anything, and ran/installed the app on my phone (simply clicking the RUN button from the SDK), and it worked fine ... I see the metal balls rolling across my screen.
NEXT, I figured I would make a small change to the project and see what I have to do to rebuild/remake the app, since I see 'make project', 'make app', 'rebuild', 'build apk', and 'synchronize' ... still not sure what all those do exactly.
So, my simple change was in the app/res/layout/main.xml file, and all I changed was
from:
android:background="#drawable/wood"
to:
android:background="#drawable/ball"
After this change, I went through every possible make, build, clean sequence I could think of, including the synchronize options within the different files. I've even disabled the instant run feature, uninstalled the app from my phone, restarted my phone, and restarted Android SDK. I even found a checkbox to "skip installation if APK has not changed" in the RUN/DEBUG configuration window.
What am I missing? Every time I RUN APP, it's as if no changes were made ... I get the same "wood" background from the original main.xml file.
Here is a link to the repo: https://github.com/googlesamples/android-AccelerometerPlay/
I checked the code and if you take a look to the AccelerometerPlayActivity you can see that the background of the view that acts as the activity content (SimulationView) is being set on this piece of code (in the onCreate method):
// instantiate our simulation view and set it as the activity's content
mSimulationView = new SimulationView(this);
mSimulationView.setBackgroundResource(R.drawable.wood);
setContentView(mSimulationView);
So, that's where you have to make your changes.
At first, I'm new in programming of Android. And I have a problem/question.
Every Time i will click the 'Run' button to build and run my application on my device, my changes in the activity doesn't update/apply on device.
Is Anybody the, who know what i mean and know how to fix my problem.
I tried to find something in the preferences but i haven't found something.
At the moment i have to rebuild every time before run but this isn't a very nice way i think. There should be a better one.
Thank you for your answers.
Greetings
If you are using Instant Run, this is probably whats causing the problem - it doesnt recognise the changes you've made (at least that was the cause when I first had this problem). Just rebuild or clean your Project as already suggested - this will cause Instant Run to fully reinstall your application and not only install the new Patches. For me it occurrs quite often, I don't really see a pattern behind it but it's usually when I go to edit a completely different file/class, or when starting a new programming session.
Goto Build > Rebuild Project after that click Run again.
If it does not still updates your app I suggest to uninstall the app on the phone or in your emulator then Run again so a that a fresh APK copy will be installed.
Note: This is an odd thing when you are just running again without changing anything in your code.
The content should change, but I've noticed that with the latest instant run method, asset files typically don't get updated when you run it again. You could try setting up your preferences again and making sure you have updated your gradle, but if it's not updating you can simply kill the app before you run it again, either with the red stop button on Android Studio or though your phone.
Somehow, whatever code I add to my program it does not run on my android device. It just runs my old code.
I am constantly deleting my app from my phone in the App Manager.
If I add new or change functionality the old code still runs.
I even delete complete blocks of code that should obliterate functionality. But somehow all the old functionality remains in the app after reinstall.
Simple example: On a TextButton click i shift some UI element by 200. This works great. When i delete the complete button listener it still works great but i guess completely by itself since the code should be gone.
I tried restarting Eclipse without luck.
This thing is driving me crazy. I was stuck for hours on some simple code and baffled why it did not run. Then I discovered my logs where not showing in logcat. Somehow, sometimes it does update the new code into the device since now i have a log on device resume but i deleted that at least 30 minutes ago and now it is still showing in my logcat.
Desktop app works as it should. I somehow have the feeling this happened before and over time this got worse, up to this point where i cannot test anything anymore.
So to be clear:
I add code to my app.
Run it from eclipse as Android application
No changes show up
Delete app from phone using the phones Application Manager
Delete a complete code block like the show() method that holds my complete stage
Run it from eclipse as Android application
App still runs as it was with the complete stage in tact.
-- edit --
Now I did not do anything to my code for a while and ran it. Now it probably took the code with the version with the empty show() method. However this already has been undone in the present. Could eclipse be stacking runs?
Check
"Project -> Build Automatically"
is checked. (Most likely your problem).
Also doing a
"Project -> Clean..."
tells the IDE to delete any previously compiled binaries and rebuilds them. (The APK file).
This could happen if there is an error in your code and you have selected run without warning when error in program exists. In such a case the last successfully built code would get pushed! As Lestat mentioned try doing a clean, if the project now shows up errors you have your culprit, else make sure your XML files are all proper.
Another check could be to see the timestamp of the last generated apk file in your workspace.
PS: There is a bug in eclipse where it doesnt save a file at time, a simple workspace restart fixes this.
Had the same issue - updated my code and yet the phone was running the old.
Tried Build --> Clean Project
Tried File --> Invalidate Caches/Restart
Now it works and recognizes the new code!
That said curious what #1 and #2 did behind the scenes??
There's hard to name this problem so that i attach screen. It starts normally. All preferences seems to be ok. It has been restarted several times and it does not work. Can not open any perspective. Every option from main menu is disabled(grey text).
Regards
I'm using Eclipse and the Android plug-in for my Android phone development. I just worked through my first application from the "Busy Coder's" book and I'm having a persistent problem. Every time I run the example Java application, using a properly configured Android Run configuration that references the example project, the emulator starts (if not already started) and the application is seemingly deployed to the emulator. However, what shows on the emulator is not a reflection of the application's current state. Specifically, the example application I typed up should display the current time and then every time you click on the main app view area it should update the current time (via a Button object instance created in the constructor that has an onClick() handler). Instead, I see "Hello World" and clicking on the main view area does nothing.
It's as if some old copy of the test application is being pulled up. I even hunted down the strings XML file for the project and I did find a string declaration that was defined to "Hello World". I then changed that string to something else, rebuilt the project, and re-launched the application. But I still got the same "Hello World" display and still do not get any response when clicking on the main view area. I even tried shutting down Eclipse and the emulator and nothing changed, and also cleaning the project before a test run.
So, what are the usual mistakes a newbie makes that could cause this situation?
-- roschler
This happens to me occasionally but it is usually fixed by deleting the application from within the emulator UI.
After deleting the application from the emulator and reinstalling it I can launch the application using "Run". After this the application is updated every time the "Run" button is used.
Check the console to see if the activity is actually being installed and launched rather than being brought to the front when you "Run" the app.
If you launch in debug mode, the new build will always be installed in the emulator/device.
However, if you launch in run mode, you need to increase the version number in AndroidManifest.xml, or the new version won't always get installed.
Please see Android: Eclipse doesn't pushed new version of app to emulator from earlier today.
Hope this helps,
Phil Lello
By far the most common reason this happens to me is that I failed to notice that there was an error compiling the application so it didn't push the new version. Especially when my package explorer is obscured so I don't notice the red X.
Edit: one other reason it often happens to me is I have more than one emulator running or my phone or tablet plugged, and I accidently install the latest version to the wrong device without paying attention.
I open the manifest file in Eclipse, "touch" it by deleting and undeleting something, save it. This seems to refresh the APK for me.