Android Studio Project SDK Path Mac VS Windows - android

I use 2 machines for development, Windows 8 desktop and a Macbook for when I'm away from my desk. I use dropbox to sync my development files between 2 machines. This works pretty well, except for one thing: the SDK path must be updated every time (http://screencast.com/t/XKnqUjiBn)
Is there a work around of some sort for this?

Don't share the local.properties file between machines; that's the file that contains the SDK path, and as its filename indicates, it's supposed to be local to an individual machine.

I suggest that you take a look at a GIT source control (if you haven't done that previously). It is the way better way to manage projects than dropbox sync.
There are 2 very good options for you:
GitHub - free for open source projects, paid for private repositories (paid per repository)
BitBucket - free for private repos too (paid per user)
AndroidStudio (which I suggest for Android projects unless you are working with NDK) has a really good support for importing projects to GIT via GUI. So it helps you a bit if you are not familiar with console stuff. But it is easy with console too. Check out this github tutorial for beginners https://try.github.io/levels/1/challenges/1
With GIT the problem that you are trying to solve is simple just put a file name that you dont want to share into you gitignore file. You can find android preset gitignore files online on sites like gitignore.io.
Good luck.

Related

How to merge 2 android projects

HI I have and android project A, I have been working on it, and also a friend of mine has been working on it, so now I have 2 projects A-Mine and A-Friend (I have nor svn, cvs nor git). Is there a way to get a diff of or to merge them, using ecplise or tortoise or anything (windows based)
Thnak u very much best regards Ignacio.
Now's a great chance to set up source control! Commit your version into source control, have your friend check it out, create a new branch and recursively copy all his files into it. Then just use the tools provided by your source control software of choice to merge those changes into the main branch. Done!
As I thought my friends there is always another way, Turns out ecplise won't allow you to open twice same project in the same workspace, but you can very well match up files and folders with simple windows copy + paste, so what is what you do? Yo open one project in eclipse and paste the renamed folders of the second project. the you can use Eclipses Compare With tool, to match up all files in a certain directory.
Clean, easy and fast

How can I use ADT on both my Mac and Linux Dev Machines

I want to have the SDK available on both machines and sync the projects via Dropbox. However, since the SDKs for Linux and Mac are different, I have to chose a different SDK folder each time when launching Eclipse. Any workarounds?
I actually did something similar to this a while ago. I found that managing the ADT plugins (and SDKs) separately on each machine was a better solution, since they had path dependencies. I used Google Drive (Dropbox in your case) to hold all of the projects, which was ok at syncing the projects, but tends to run into issues with all the binary files created when building projects. As my projects grew larger, this became a bad solution for keeping things in sync as there were constantly syncing issues due to the amount of files that needed to stay in sync.
The best way to really do this is to use source control to keep your projects in sync, and I strongly recommend Git over CVS or SVN. GitHub offers free public repos and paid private repos while Bitbucket offers free public and private repos. I moved all of my projects to Bitbucket and now have them synced between machines, backed up, have stored histories, and can be shared publicly/privately (if I want).
In my opinion you should move away from using a file syncing service and use source control, it takes a little effort up front but is well worth it in the end.
Try syncing only the actual code files you create, not the project itself (i/e file1.java if you're writing in java, file2.cpp if in C++, etc). You might have to monkey around with adding new files, but that should be as simple as importing/exporting. You're going to have all kinds of trouble syncing paths for 2 different machines...
Otherwise try a free source control like assembla

How to use a Android Studio project on two computers?

I use two computer for coding. My desktop pc and the notebook. I sync the two computers with dropbox. How can I import/load a project on each of this two computers? The project base folder is different on each computer. When I try to load/import a project which is created on the other computer it loads the project but I got a error with a wrong path.
"Gradle "Test2Project" project refresh failed:
Could not fetch model of type "IdeaProject" using Gradle distribution "http://services.gradle.org/distributions/gradle-1.6.zip".
Project directory "C:\Users\thomas\AndroidStudioProjects\Test2Project" does not exist."
The wrong pfad is the right pfad on the other computer. How can I import Android Studio projects so that it works even on another computer with a different folder structure?
Like the others i agree, that using a VCS would be the best solution. Even though you can try to filter all android studio related files (like *.iml, .idea folder and local.properties). I don't know if you can do this with dropbox or if you need some kind of 3rd software.
After that you should be able to make source code changes on both computers without greater problems. (You may have to declare project dependencies changes for the android studio twice)
Builds depending on the build.gradle files should work to. But again: using a VCS is the better way to go.
Go for git, you can use bitbucket.com as a free remote repository.
This is a problem I have ran into when trying to store Android projects in a Dropbox folder. What happens is that Machine 1's IDE is mapping system resources (like the SDK) as being in that machine's filesystem. When you go to Machine 2, everything will work EXCEPT for what you expect--because the SDK will probably be in a different spot!
One way to get around this is to use your VCS (dropbox, git, whatever) as a repository for JUST your source files, and then have a local project created on each machine that reads from the Dropbox folder. This requires two separate projects that are mapped differently, but that have the same source folder.
I discovered this problem when I tried to load up an Android project on a new install on a Mac machine:
Do you see what's happening there? My Mac Android Studio is saying, "Hey, I don't see where "C:\Android\SDK is, but I do see that you have an Android SDK in a different folder, so I'm going to update your project files to reflect the actual location of the SDK."
In my opinion, the only way around this is to create your project on both machines, and version control your source and assets folder. If you don't create the project separately on each machine and use VCS for just the source and assets, the only way to get around build and filepath errors is to store your SDK in the same folder on each machine. This worked for me when I was building on a Windows desktop and Windows laptop, but no longer works for me since I am using a Macbook Pro.
I know this was questioned about 4 years ago, but this is up to now still an issue. Using a VCS seems like a good solution, but for me it is simply more overhead than i want to have. I also use Dropbox to synchronize my folders and the history they provide is for my private programming needs good enough. So i think, it would be good, if android studio simply uses relative paths.
I know it needs some system paths and it does a good job in looking at the local.properties and setting it to the correct place when the project is loaded.
The main problem with using Dropbox are the build-directories. There are many many references to fully qualified paths in the files within these directories. So my solution was to exclude the build-directories from Dropbox-synchronisation.
When you work at your laptop, build the app, create new files, change files or delete files, the build on your pc will be completely outdated when you switch back to it. but android studio will recognize this and do a fresh build when you start your project for the first time after working on the laptop.
so the biggest problem at this point is the file local.properties and this is handled correctly by android studio. it may be a good idea (or a really bad one, i don't know the drawbacks) when the build system wouldn't write fully qualified paths in the files within the build directory.
But up to now this is my solution for using Dropbox and not using a VCS:
exclude build-paths from Dropbox synchronisation
i hope this helps somebody.

New to GitHub - is there a way to get an overview of projects on it before unzipping and building?

I've been looking for a finished/working ImageView on Android that has pinch/zoom behavior. Although there are code-snippets all over S.O. for this I want something a little more finished that I can just build and use.
GitHub, which I've never used before, seems to have candidates. As far as I can tell GitHub is a free, public project-hosting, source-control system, but I'm only interested in downloading and trying out projects on it, which can be done by the "Download Zip" button on it.
I recently tried a project called PhotoView but after getting it all imported into my Eclipse development environment I found it had dependencies on a higher API level than I was using or targeting.
Is there any way to avoid that in the future? I.e., is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Edit: In my browser I can see a brief revision history but it looks like it only goes back a few changes so the manifest or other key files aren't always visible. Is the only way to see the project files to download the ZIP file, unpack it and look at it in my development environment on my local PC?
Thanks in advance.
Is there any way to avoid that in the future?
Browse the source code. For example, the manifest file (for the component or a demo app) should indicate the android:minSdkVersion.
is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Yes. It's called the project README, and you were already there, most likely, as it is the "home page" of the repository. The amount of documentation any given developer will write for any given component will vary.
You are also welcome to file issues against the project, asking for more documentation on this sort of thing, but if and when that issue will be acted upon will also vary.
readme file in root of the project, and Wikipages of that repositories could help you find out additional information about that repository. But at the end, contributors are responsible to prepare this kind of information and some of them don't care. So, you can look for Android manifest file of the project and check the content in GitHub website before download and unzip it.

Do I need SVN to download this project?

Android newbie here and would like to create a basic app using the AndriodPlot library.
The instructions to download are:
svn checkout https://androidplot.jira.com/svn/ANDROIDPLOT/
trunk/Examples/Quickstart Quickstart
Is there a way to download without SVN so I can get started?
If not, what SVN and how do I use it?
I assume it is some sort of version vcontrol but after Google-ing SVN, I am getting a lot of different answers and it is not clear what I am suppose to do...
Any point in the right direction to download this is greatly appreciated.
Yes, you need SVN to download this project.
What is ment by SVN is Subversion.
Depending on the platform you are using, you have to install a Subversion client. Under linux distributions, just search for the subversion in repository.
Under Windows and Mac OS X you'll find a graphical client, that will suit your needs.
You could download all the files manually or work on individual files e.g. https://androidplot.jira.com/svn/ANDROIDPLOT/trunk/Examples/Quickstart/src/com/example/MainActivity.java
but it's gonna be easier to just install svn and then checkout the repository and get a copy of the files on your machine.
Red bean did a good intro and guide when I was learning it http://svnbook.red-bean.com/en/1.1/ch01.html
And PS. learn GIT (better and now widely used)

Categories

Resources