Several times I have seen documentation that makes statements like "set the XXX variable to YYY", but I am not at all sure how/where these "variables" get set. Sometimes it looks like they may be old-style DOS environment variables (which I know how to set), but other times not.
So for example, looking at this SO question, the accepted answer states "NDK_MODULE_PATH must be in your path" - would that mean the DOS-environment-path? Or some other path? And in this document, it says "When you compile, you need to set the NDK_MODULE_PATH variable to the directory above...". What kind of "variable" is that? A DOS-environment variable? Some other kind? How/where would I set it?
EDIT: Just a thought - if I go to Window > Preferences > C/C++ > Build > Build Variables, I see I can add things there - do you think that's what was meant in the two examples?
Related
I would like to rename all of my java classes and layouts that starts with the prefix tranp_ to event_. I can do that one by one using the combination Shift+F6 but it is taking too much time (there are more than 20 files). Is there a quicker way to do that in bulk?
Although is an old question, I feel it's worth answering as there is a valid solution.
Open the project with AndroidStudio, then right click on the main project's folder, select "replace in path" and enjoy it. I just replaced 400 occurrences in less than 40 seconds, just make sure you really need to replace all statements!
There seems to be no feature implemented to rename multiple files at once through refactoring provided within the Android Studio.
I also feel the need to have such feature as I keep changing my decision to name elements of certain category to some specific manner and thus have to tediously do it one by one. Which in many cases causes the bug.
I hope the future version will have it but till then what I am doing best at the moment is use the 'ctrl+r' feature to search all the occurrences of the item and replace it with what I want to rename to. And then do it again on all places where the element has been referenced. And then at last to make sure that there are no errors caused by the recent renaming I just run it. If any errors like "resources not found" then the Android Studio does point me to the location of the error, which generally is the place I left to rename.
Although this is not a sure way but it has helped me quite a lot when you have to rename lots of elements instead of 'shift+f6'.
So since I have tried the reply before me and it didn't help, I actually did find useful to open the direct path of the files I want to change, selected all of them and just pressed on rename(On MAC). It gave me the option to replace specific letters in all of the files. Made my life much easier after changing about 30 files, and noticing I have another 250 to change at least.
I am currently trying to find out the values of $HOME and $ANDROID_AVD_HOME as I am having difficulties running an emulator.
I have searched through various posts to try and find an answer, people simply suggest "changing this variable", however I have no inkling how to find the value or location of these variables.
I would, ideally, like to know how to display their values then, if I need to, change them.
Where I can find full list of Bitrise default environment variables with actual values?
I can see list of variables in Select variable dialog:
but there's no possibility to check their values. I don't want to print all of them in command line using echo and check their values.
Would be nice to have this information in bitrise.io documentation, which is missing at the moment.
I've found some bitrise* repositories in github, and in the source code of steps I was able to check some default values for environment variables. It's still not the desired result.
Why we don't have docs for the values: because it can change any time. The point of Environment Variables is that you can reference things where the value might change. The variable's meaning remains the same, but the value might change.
For example, $BITRISE_SOURCE_DIR refers to the main working directory, which (by default) is the code directory (where your code is git cloned). On the OS X stack it's usually /Users/vagrant/git, on the Android Docker stack it's usually /bitrise/src; but we don't guarantee that the location won't change in the future, and you can change this location as well.
Another important thing is, if you use the bitrise CLI to run your automation on your own Mac, the $BITRISE_SOURCE_DIR environment variable will be set by bitrise to the directory you call bitrise from, which is usually the same directory as on bitrise.io VMs, the one with your code.
Why is this important? If you use the $BITRISE_SOURCE_DIR environment in your script instead of a hardcoded value, it'll refer to the same thing (the source code directory path), no matter which environment you use to run your automation.
I've searched high and low for people with the same question but have only found some variations (i.e. R file not generated at all) that don't help. I'm VERY new to Android development (day one, actually) but from some tutorials I've been reading, this behavior is unexpected. Basically, let's say I create a TextView in my activity's XML file and give it an appropriate android:id. I save the file (and all other files), but if I try to use findViewById in my Java file, the R.id.[view name] is not listed (and displays an error if I manually type it in). If I do a "Build Project," it works, but to have to run the Build command upon creation of every new component will be a huge burden! Has anyone else experienced this or have ideas on why it's happening? Thanks in advance!
If everything else you mentioned is correct, then the only way for you to NOT get the proper R variables is that you might be importing "android.R;" file in stead of your actual R file "your.package.R" which contains the variables you are looking for.
Regards!
You may have to tell your IDE to automatically rebuild changes you make. For example, in Eclipse this would be in: Window > Preferences > General > Workspace. Make sure Build automatically is checked.
I have done some significant re-coding on one of my Android programs and now I am unsure if certain xml strings are used anymore. In addition I have a few translations which makes the task even more difficult. Is there a tool to test this? This would be useful for drawables also.
I am using the eclipse plugin.
This question has been discussed in the irc channel before. There is no tool to test it, but I agree it would be useful. Note that resources can be referenced in xml, but they can also be referenced from code. Furthermore, resources can also be looked up by their identifier, and such lookup could be determined by runtime.
So actually you cannot determine 100% whether a resource is used or not anymore, but you can probably determine which resources are referenced in a static way (in xml or code). Depending on your code/app which you know best yourself, such approach might be sufficient in many cases.
The approach would be to write a tool that parses xml and java source files and also take the import statements into consideration. With that information you should be able to determine which resources you can get rid of.
The easiest way is to remove them all, attempt to compile, and re-add those the compiler says are lacking. It's a little tiresome, but it's certainly tractable.
Note, as Mathias already pointed out, that it's technically possible to access resources by name with a string at runtime, and the way I suggest here would remove such resources though they are, in fact, needed. However, this pattern should be really rarely seen in any application, and if you are the one who wrote it, you already know if/where you do such treatment.
Use grep to extract a list of resources to a file by way of sort
Use recursive grep through sort and uniq to create a list of those mentioned in any source file (make a copy of project without unused files or dispatch grep on a list of used ones, of course commented out code will be an issue)
Use diff on the two lists