How to restore a deleted RunConfiguration in Android Studio? - android

I was trying to deal with a testing-related problem and I followed this advice:
https://stackoverflow.com/a/32267762/2576903
Now whenever I try to run my tests, I get prompted to choose a device.
How do I restore that build configuration?
I tried git commit to see changed files, but it seems that it was somewhere outside of the project folder. I also tried invalidating android studio's caches but nothing seems to work.
I tried creating another test class automatically (by control + enter on the name of a regular POJO) but the configuration wasnt created.

Went to the folder of my current test class,
created a new class
inserted annotation #RunWith(MockitoJUnitTestRunner.class)
right clicked the newly created class' name -> Run
and it created the configuration.

Related

How to Completely Remove an Android Layout from Android Studio

I'm building an app in Android Studio and I accidentally created a base LoginActivity template but then deleted it because I wanted to make my own. Now, when I try creating another activity with the same name, it tells me "Layout name must be unique."
I could just name it something else but:
I don't want to
There would still be some sort of duplicate files in my system doing nothing
My goal is to just remove all mentions of activity_login, ultimately so I can make a new activity with the same name, but I can't figure out how.
Go to res->layout->activity_login.xml and delete it from android studio
Or open project in file explorer, then Go to app/src/main/res/layout/activity_login.xml and delete it
If it didn't solve it, Invalidate Caches and restart Android Studio.
That's happens sometimes.
just go to : File->Manage IDE Settings -> Restore Default Settings.
This will solve it for sure :)
I had the same problem. Empty res/layout/activity_xxxxx.xml and invalidate cache didn't work, until I found there's xxxxx.java existing in app\src\main\java\com\example\xxxxx. After deleting the .java file as well, I found that I'm able to create the Activity file with the same name.

Android Studio detects no changes with copied files so can't PUSH to Git

A very common thing that I tend to do is when I need to update a graphic or something in the drawable-nodpi folder, or any other folder for that matter, Android Studio doesn't detect the change so of course when I try to "PUSH" to GitHub it doesn't actually push and just tosses me the "No Changes Detected" message.
Is there a way to push anyways? Just to force a commit on specific files that I want to push because I know for a FACT there was a change and I need it submitted?
Lately I been having to delete it first from within Android Studio, then save the file, then add it to GIT then try a commit, but even this works only 70% of the time and is very annoying.
Perfect Example.... I have a splashimage.png in the drawable folder, I am in Photoshop and I change something then do an override to the splashimage.png with my change, but of course Android Studio doesn't see this as a change so I can't Commit this file to Git or anything.
Are you using external editors like photoshop when editing files? If so, press refresh in Android Studio to make it detect changes in file system. Then it says something has changed and suggest you to commit. Of course you can use command line to add changes anyway and commit without even using Android Studio.
Apparently the item I was looking for was the Synchronize. I just go to the file and Right Click > Synchronize and it then does a check against the last one manually and see's if it was different. Kind of a Refresh like Kuitsi had stated, but its called Synchronize. Also some reason I can't get it to work by just clicking Synchronize next to the SAVE icon at the top under File menu. Not sure why.
Whats your git status after you copy the file? Do you commit the changes, before pushing?
Have the same problem. Resolved.
The multi-root project used to work just fine for years, detecting changes in sub gits, properly pushing/pulling per sub, but not anymore. After some playing with a broken merge, it has stopped working. And that's not a local git repo issue. Cloned it from scratch - same issue. Changes (doesn't matter internal or external) are not detected by the Studio VCS facility, though git from console shows changes, View/Recent Changes shows them, Local Changes tab doesn't show any (single Default changelist).
It looks like something has happened with the VCS roots detection or related settings. Fixed with Preferences/version Control adding missing roots manually. I wish there is an option to rescan a folder or to delete some settings file and have the studio detecting these roots again.

Generate Annotation files Automatically in Eclipse

I am using Annotations and svn(Version control) in my application. I have created one package inside of my application and some Activities inside of it. Now the application is perfectly running. I just committed the files to svn and tried to checkout files from another one pc. Now my projects contain some errors. The errors happen whenever I use intent for calling new Activity that shows an error. The error says "Summary_ cannot be resolved to a type"(Here I mention summary is my Activity name).
And I just add a space in that java file and save the error is gone. But I can not ask other peoples to do this every time. Because this also happen whenever the eclipse is restarted or when I clean my project . Checkout from svn. Update svn.
I guess the annotation files are not generated. Please anyone help me to solve this issue.
Note : I just added a space(or whatever) in that java file and saved. the error is gone . I want to know why it is happening?

changing directories of android projects and svn

I have two projects sitting in our SVN repository that are android apps. the second is based on the first, and was split off it some time ago. for example purposes, we will say the first app is called "phone app" and the second is called "tablet app"
they are stored on the svn server at the locations
http://server.com/svn/mobile-apps/phoneapp
http://server.com/svn/mobile-apps/tabletapp
that works fine, and we can check them out from svn in eclipse.
the problem is when importing the code as an android project.
the first app, the original app, gets stored at
c:\workspace\mobile-apps\phoneapp\
but the second app, since it's a copy, stores at
c:\workspace\mobile-apps\phoneapp (1)\
i realize this is probably a setting in the tabletapp application, it wasn't changed and so it's trying to save to phoneapp, eclipse see's that the folder already contains a project, and so it defaults to phoneapp (1) for the directory.
my question is, where exactly is this setting? i've checked throughout the project and cannot for the life of me find it. i thought refactoring would do it, but that never seemed to have any effect on the folder structure (it did change the name of the application fine)

Renamed Activity and now it won't launch

I renamed an Activity using Eclipse's refactor menu.
I cleaned the project and recompiled.
When I go to launch the Activity, the lines execute with no error.
Intent launchScreen = new Intent(this, ActivityMyScreen.class);
startActivityForResult(launchScreen, REQUEST_MYSCREEN);
I set a breakpoint in the onCreate method of the Activity being launched and it is never reached.
The only information Eclipse gives to me is in the LogCat, where it says the following every time startActivityForResult is called...
Initializing inflate state...
Any ideas?
There's a reference to the old activity name somewhere in your project. Probably the project's manifest file, but it may be elsewhere.
The easiest way to check would be to use Eclipse's search functionality to search the whole project for references to the old activity name, and correct any that it finds.
In my experience Eclipse does not always detect when it needs to rebuild the project in this situation, so it's also a good idea to clean and start a fresh build.
I'm a newbie, but I found checking (choosing) the following options did it for me without a glitch.
Update similarly named variables and methods (Be aware that you need to also choose Find exact names within the configure menu/link)
Update full qualified names in non-Java text files
Eclipse shows a preview of changes in all non-Java (manifest, etc.) files before committing the change.

Categories

Resources