Sharing project folder in Android Studio - android

How can I share a project/working directory between two Android Studio installation in two different computers? The shared repository is a file sharing cloud service like Dropbox.com or box.net.
The reason I want to do this is that I have a desktop and a laptop each with Android Studio. I want to be able to seamlessly do development work between the two systems without having to checkin or checkout code in a code repository.
I don't plan to run the two Android Studio concurrently. This is just for me - one user.
I used to be able to do this with Eclipse ADT but with Android Studio I am getting multiple errors - missing libraries, etc.
Any suggestions on this use case is also welcome.
Thanks in advance,
Ray

It is actually working, to begin with. It was an oversight on my part. I needed to download the latest version of Android Studio (including the updates). Since applying updates I can open the project in another device by referencing the project working folder in the shared folder (in this case Box.net). I just get an initial prompt on the SDK location, that it is unable to find the original location. But it did offer to use the SDK location on the current computer.
When using the current device's SDK folder it will say that it will "modify the project's local.properties file." I click OK on this and it's all good.
This is what I wanted to do. But I'm looking at GitHub now. Thanks.

Related

Why don't we have a single file to open an Android Studio Project?

Why don't we have a file similar to the .xcodeproj (for XCode applications) or an .xds (for Sencha Architect Projects) for our Android Studio Project?
I'm pretty sure a good number of you here have experienced the frustration of trying to import a project you see online in order to piece it apart better and learn how it works. I get that we are supposed to Import Android Projects built using Eclipse and Open Android Projects built using Android Studio.
However, why is it that we have to go through File -> Open -> then pick out the directory of the Android Studio app that we want to open? And the thing is, Android Studio doesn't seem to know it's an Android Studio project until it tries to open and build it. In the screenshot I have below, I have the sample Android Studio projects of ARToolKit, but I've only imported two of them.
As you can see, only those I've imported "can be seen as an Android Studio Project" as indicated that they have the Android Studio logo instead of a Folder.
This can be an issue for those just starting to develop in Android Studio on their own and they try and use existing projects (build from Eclipse or Android Studio) and they hit a snag with just trying to import the projects for reference. They might not know that they should import the folder and not the projectname/src subfolder. It adds to the "steep learning curve" that Android Development has if opening/importing projects aren't streamlined to a degree.
To sum up, my question is:
Why don't we have a single file that we can open that would in turn open Android Studio and import and build the project if it isn't built yet?
Android is not iOS. iOS development is only possible in xcode, hence it makes sense they added a shortcut to open it in xcode directly with a .xcodeproj file. Make life easier for iOS developers.
Android development however can be done outside of android studio as well. Eclipse is just one example, there may be other IDE's that support this. This is possible because android has standalone SDKs and tools that third party applications can use. iOS does not.
Imagine you are working on an android project in android studio. Then your boss tells you someone from 3000km away is going to help you. This guy may be using android studio, but maybe he isn't. When there are multiple options that developers can choose from individually, you do not want to pollute version control with files that you are using, but others may not care about. Each their environment.
This is merely a logical conclusion that you can come to by comparing. The "real" reason why this was done can only be answered by the people that created (adapted intellij) android studio.
This has been very frustrating to me too.
I try to give you a "beta" answer, waiting somebody to confirm it to me.
An Android project is just the composition of many parts that in some cases are concurrent to create the apk file.
It's just like what happens for the whole java projects: you have the main/src/java, the main/src/test, the maver or gradle files, the gradle or maven wrapper, the manifest, the configuration etc.
So you won't have a single project, but a series of folders that can contain many "flavours" or "versions" of the product itself.
The only help it is given to us is the Android studio icon that appears if a folder contains an android project in its subfolders.
I don't know if I have really answered to you, I just have given you my impressions and my thought.

Moving Android Studio (Settings) to another Computer

Please don't confuse this with moving Android Studio Projects.
I'm about to buy a Surface Pro 3 (i7 or i5) for college and to program with IDEs. I have a laptop that I am currently using. It has all my Git (BitBucket) settings, shortcut preferences, UI look and much more. I don't want to set this up again because of how long it took me to set all this up (Sum total of days). I was just wondering if I could export the settings by flash drive or a folder I could just copy to the new Laptop and BAM!!! everything was as I left it.
I know I can do this with Eclipse but not sure for Android Studio. Thanks for help.
Separate but kind of the same::
I was just wondering if I could use the same SDK Folder with all the API, Tools and Extras for both Eclipse and Android Studio. I used to use Eclipse until I found out recently that Google would soon stop supporting Eclipse IDE for Android. I have very complicated projects in my Eclipse IDE so I can't export them to Android Studio or I would have.
So I was just wondering if it would be safe to use the same SDK folder for Eclipse and Android... OH!!! and Visual Studio 2015 (I wanna start messing with this since you can now use this to program Android Apps with C#)
Try the option File > Export Settings on your old laptop and then save it to a jar file.
Then copy the jar file over to your new laptop and then use aFile > Import Settings to import the jar file.
You can move/backup it manually using tutorial of changing android studio settings location
The best option to share AS settings is using IntelijIdea settings repository
The feature is supported by Android Studio. You may create and attach this git repository to any IDE copy and every workstation.
The local/remote settings are synced automatically.
On the other hand, a particular project settings should be shared by using a git tree. Modify project settings profile by adjusting your team's code style conventions, for example. Then do not ignore .idea/codeStyles folder and share it with git.
Other team members after cloning/sync should also switch code style to project.

Anyone know how I can run an android sample app?

I'm fairly new to android development using Android Studio. The examples online say to build with Gradle. I choose Gradle when importing the project but then I get an error saying that it is not a Gradle based project. Does anyone know how I can get over this to run it on my phone?
Pick a sample project to import that has build.gradle file in BOTH the app module directory AND the project root directory.
Strongly recommend rather than importing an existing project, you create a new one from scratch yourself, following along with a tutorial.
Here's a really good first tutorial for Android Studio which is recent (August, 2014) as of this question, so it will all be relevant to the current version of Android Studio.
http://www.codeproject.com/Articles/801078/Hello-Android-The-Hello-World-Application
As far as getting the app onto your phone you can either (a) plug in the USB cable from the phone to your PC and run from Android Studio, or (b) email the app's APK file as an attachment to any email address you check on your phone (such as gmail for example). For the email method, you also need to change a security option to allow apps from unknown sources.

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.

IntelliJ 12 Android Setup? Nothing works

IntelliJ 12 does not generate the needed files to start Android Development.
I've setup both JDK and SDK and intelliJ seems to see the correct paths.
I am coming from Eclipse which generates everything you need to start pretty much out of the box.
I've tried...
Double triple checking file paths.
Searching...alot of searching.
Making new files from scratch.
Making hello world program, still doesn't generate needed res folder and AndroidManifest.xml file.
Changing file path directly to AndroidManifest.xml's containing folder.
The one thing Eclipse provides that is missing from IntelliJ is and Android SDK install wizard. In other words, you would have to preinstall hte Android SDK from Google prior to starting with IntelliJ. Other than that IntelliJ actually provides more out of the box than Eclipse. (Especially considering you have to manually install the Android plugin before you get the Android SDK install wizard.) Go to the Google Android developer site to find the Android SDK and once you've done that you should be able to get up and running pretty quickly with IntelliJ. Start a new project and select Android. This should walk you through a new project wizard which will setup the necessary res and gen folders for you.
I've put together a screencast on Android development using an Eclipse stub project here: http://bit.ly/Zu6q8i

Categories

Resources