Save code before running android emulator? - java

Do I need to save before running the android emulator on eclipse.
I get the error MainActivity.java has been modified. Save changes?
Can I not save?
Thanks

If you were to run without saving, your new code would not be compiled and the emulator would not run the code you had just typed. If you are not sure about a change or want to keep older versions, just use the Save As command and keep multiple versions.

The answer to your question is Yes, as ADT would check up the changes in the code, else the previous non updated code would be executed. There will be also a case where you have rectified a problem in your project and you will be still be facing it in the execution if the project is not saved.

You're answer can be found here
The answer, is yes. Yes, you have to save it.

Related

Android Studio does not reflect my xml changes

When I do any changes in xml layout file, it doesn't reflect with new compilation build although R.java is generated but when I run the application changes doesn't reflect. I need to rebuild the whole project which is taking time. Any help on this?
I guess before it was working fine.
Yes Sometimes it also happens to me. If you are doing changes i right way in the Xml file then those must be appear when you run your app. But if it does not happen, then you need to rebult your application, or clean it several time. if it also does not work to you then do the follwoing :
Close and re-open (Restart) the android studio and try running app again.
If step 1 is also not helpful then Uninstall app from your device , Disconnect and connect device again and rebuilt/Run app directly in your device again.
I hope this will work for you.
Pleas check if you have enabled Power save mode (File -> Power Save Mode) which turn off auto compilation
Android Studio - Auto complete and other features not working
I "touch" AndroidManifest.xml and that forces a build. Does not take nearly as long as rebuilding project or restarting emulator. It's a hack, but hey, it's my hack.
This sounds similar to my situation. I had an extra quote character in my colors.xml file, which caused errors when I tried to run my app. What worked for me was to remove the extra quote in my colors.xml file. Then I saved the file. Then I restarted Android Studio.
You can simply switch to project view and remove the build of the app:
After a few days of fighting this issue, I solved it by deleting all "v26" directories inside the "res" directory, since the activity was using it instead of the usual "layout" directory for accessing the xml.
app/src/main/res/layout-v26/
had to be deleted and you should remain only with
app/src/main/res/layout/
Anyway, I am new to android development and am not sure if this can lead to other issues, so be careful.

replace android studio project and keep signature

I've been working on this project for months, and when I started out I knew nothing about android dev, gradle or signatures. Since Android studio was also quite new when I started in June, and updates often brought errors in the gradle, the code is a bit messy.
Now, I've been trying to get the new support library imported into my project - without success. Re-importing the project seems to fix this nice and easy, but this means I have to replace the old project(package anomaly). My question is, since this app is already deployed, will I loose the old signature and with it the possibility to update the app on Google Play store?
Hope to hear from ye! Thanks.
[EDIT]
Yep, worked like a charm :) Thank you Samuel!
If I am answering the question I think you are asking, can you change the package name and still upload the application as "updates" to one that is already in the market the answer is no.
Once an application is uploaded to the market, pretty much everything can change except the key and the package.
As long as you still use the same signature and key then you should be able to compile with different things and still upgrade successfully. I highly suggest compiling what you have now and trying to upgrade it in the app market and that will very quickly determine whether or not it is possible. If you do this post back on this post if it worked or not for everyone else to see

Compiling/Building Google App Engine Java Project

Good day everyone!
I am a graduating student doing Google App Engine-Java Web Application.
My problem is I need to compile/build it so it will run upon click. I've been trying exporting it to a jar file however it outputs no main class.... problem.
I've been looking for other method but internet fails me or maybe i'm not pointing on the right track.
Here's my output whenever I'm using the command line:
its working fine when i'm using eclipse.
Any leads? Sorry if my question is quite silly.
Thanks in advance :))
Firstly you should definitely consider updating your GAE SDK as it seems the defaultZoneTL field was removed from JDK 1.6 U31. Updating the GAE SDK should avoid that problem.
If you can't do that then check http://code.google.com/p/googleappengine/issues/detail?id=6928 and try to implement one of the workarounds suggested. (Essentially launching with -Dappengine.user.timezone.impl=UTC OR -Dappengine.user.timezone=UTC)

How do you back up an android app?

I just had my app crash and now after alot of work its back to were I had it, I was wondering how would I back up the app so I can reInstall is again if this ever happens again?
u should use a version control system, example: git version control
http://git-scm.com/
happy coding!
use a version control system.. like svn or git ... in any case even if you were not using this, you should have taken backup of your code regularly... these version control system manages this for you easily...
This question is not specific to Java or Android, but rather, how to "backup" code properly. As others have already mentioned, you should be using source control systems such as Git or Subversion. Not only will this "backup" your code, it will allow you to track the changes you make to the code as well as maintain multiple versions of your code.

Java code in Netbeans IDE: Code executed is the older one! even when I make changes in the code

I am building an application in Java using Netbeans IDE. I am trying to debug some errors in my code. But even when I modify messages passed in the log statements, I do not see a corresponding change in the logged messages. This implies that when execute the code, it probably runs an older version of code & prints the old version of log messages as well.
What is the cause of this error ? & how should I rectify this ?
Thanks for helping..
I had that same problem...closing and reopening netbeans fixed it for me...
By saving the code. I assume, you are have compile-on-save enabled. If not then you have to build it before running it.
Yes you need to enable build-on-save, otherwise GlassFish wouldn't be able to show you the changes, because the new changes have never been deployed. Sometimes, deploying on save bothers a lot. So, what I do is, I don't enable build-on-save and work with tests and thereby run my tests to see the result of the change. When everything seems fine, then I build the app and deploy it on the server for further verifications.
Compile on save must be set.
See the properties of your project.
(Right click, select properties, then select compile).
Another possibility is that you have to redeploy
your project. In such a case I would recommend to
take a look at jRebel.

Categories