I don't use java much so what are the common (best practice) locations to install components like this. I want to put them in a system directory so multiple users have access.
Common locations are /opt, /srv, and /usr/local. I tend to lean toward /usr/local.
Note that the Android SDK doesn't really require you to install much, it's mostly self-contained. All you need to do is tell Eclipse where it is. You may also want to add the tools and/or platform-tools directories to the system-wide PATH so that your users can use adb and other tools.
See http://developer.android.com/sdk/installing.html.
On Linux, I typically use /usr/local/android-sdk, but anywhere that makes sense and that won't get clobbered by your system works. Just be aware that it may actually make sense to put the SDK in a per-user location, since it requires write access to create a VM image and to download SDK updates.
To be more concise and allow user writing for things like sdk installations and etc, you could put it somewhere inside the ~/.local directory as per the XDG file system hierarchy like ~/.local/lib/arch-id/android-sdk
Also remember to set the ANDROID_SDK_ROOT env variable to that directory as the ANDROID_HOME variable was deprecated.
It doesnt matter where you put the sdk. Just put it in any folder where all user's can access it...
Related
Im not sure what it is called but ill do my best to explain it. I did search here on stack exchange and found this answer for an allias for path but i dont want to set a variable for it and i already know that. create alias for path
What I need is and its been along time since I seen it but its used with a % or $ or something that when the program runs from the directory it knows where the directory for the game files are. It didn't matter what the directory the program is in as long as the directory 'gameFiles' is in that directory it will work.
Here's my path:
"/storage/emulated/0/MyGame/MyHackGame/jni/gameFiles/oscom.txt"
I think its something like:
"%or$/gameFiles/oscom.txt"
The main problem is I have a project on source forge and don't want my developers to have to change these paths like 100 times to run the program and then I'll have to change them back.
Also iam using aide for android to make the program and using the standard c++ libaray do this might be difficult to do. I'm not even sure if I can add libarays with aide and native code or how to do it.
Use symlinks as Eugene has suggested or modify build scripts to generate user specific paths into binaries or spearate files at build time. These are ignored by version tracking, so no more double mills. Another way might be checking env variables at runtime.
I've got an Android app written in Kivy (Python), which stores local files that should survive an app update (adb install -r).
If the files are stored in a subdirectory of the current directory ("data/data/app_name/files"), I see that they are deleted after update.
However after some experiments I could "solve" this by storing the files in the "data/data/app_name/shared_prefs" directory, which seems to be persistent after updates. By the way, I didn't check but maybe the "data/data/app_name/databases" also is.
Is there a cleaner way of doing things ?
I need to test if I can create a new folder not called shared_prefs nor databases under "data/data/app_name", and if it is persistent.
(this seems kind of a hack because those directories have another dedicated purpose, even though my app is not using them for this dedicated purpose right now)
(NB: I don't want to keep the files outside the app private directory)
There is not a simple way (as in a build hook or similar) right now, but it's something we've specifically discussed in the last few days as the current situation has become a direct problem. I'm not sure what the resolution was, but there will probably be a change in python-for-android to fix it fairly soon.
If you want to keep up to date with this, ask on the kivy mailing list or irc. In particular, knapper_tech was making these changes.
I am trying to set up a working Linux ecosystem inside an Android terminal emulator, but without actually having root access. This means that I need to adjust every reference to e.g. /bin/sh in the source code of every program I'm trying to compile and use.
Setting LD_PRELOAD before starting an application allows me to modify the behaviour of libc functions, just like fakeroot does; so I might just write a library which redirects all syscalls with absolute path names (except /dev, /sys, and /proc for example) to the folder I have write access to.
This library would have to:
Rewrite all path names so they stay inside the fake root directory
Nevertheless allow references from outside this directory, because e.g. procfs will still provide system-absolute path names
Ensure that a child process does not accidentally unset LD_PRELOAD
But how well would this turn out? I'm no expert when it comes to low-level code, so:
How consistently could I emulate such a "faked root directory"? Am I doomed from the beginning by the kernel which won't cooperate?
How easy would it be for a process inside the "fake root" to accidentally break out of it? I'm not talking about deliberately trying to escape via assembler code.
Edit: Maybe this library could even serve as a replacement for libc, as long as I link all software I compile on that system against it?
What is the best (most safe) way to change protected system settings like brightness, gps, data, ... within a root app?
I read about 2 ways to do so:
1) copy settings.db to your app folder manipulate it with sql api and then copy it back -
seems more than just a bit risky to me.
See here
2) use root to copy your app to the system folder and hold WIRTE_SECURE_SETTINGS permission - seems doable, but does that break the market link, so the users won't receive updates anymore? See here
Or is there a different way?
Thx for your help!
Instead of moving your app to /system/app, you can execute your "modification" commands as root using su
An explanation of how to do this using Runtime.exec() (and also one implementation) can be found here.
I use Eclipse to develop in java for Android. I have installed Mercurial to control the source files with other programmers.
But I don't like how mercurial works, without options to lock the files when someone are modifing it.
I know mercurial works in this way, but we prefer the lock "approach".
Is there any alternative to mercurial with lock files?
Is there any way to config Eclipse to avoid write on read-only files? If I have a read-only source file, with Eclipse I can open it and write in it.
Thanks.
Quote from Mercurial: The Definitive Guide:
For instance, a distributed revision control system cannot, by its
nature, offer a file locking facility. There is thus no built-in
mechanism to prevent two people from making conflicting changes to a
binary file. If you have a team where several people may be editing
binary files frequently, it may not be a good idea to use Mercurial—or
any other distributed revision control system—to manage those files.
However, right underneath the paragraph, there is a reference to an extension you can use, named "lock/unlock extension". A quick search located a page that describes the extension, but I didn't use it yet. The linked page also hints at the existence of another, older extension of the same name.
As a final note, personally, I agree with the quote from the book. If you need file or directory locking in your workflow, trying to use a distributed version control system is only going to create problems for you. You will probably be better off using a more traditional version control system.