What is the best way to create an Android project and duplicate it?
I would like to have projects that inherit a class that is responsible for the configurations and the base project to bug fixes and improvements.
Another problem that comes to mind is the design that some projects may change, for that matter should be able to add in my project resource folder that inherits the resources to change.
Thank you very much!
As for the duplication of project: you can easily copy-paste the whole project's structure and then from Eclipse you can do New Project -> Android Project -> create project from existing source.
What you are actually asking about, if I am not wrong, is Android Library project. This is a project that you can use to add on the source of other projects. You can read about android library projects here and in the linked page here.
I would use github fork system for inheriting projects and files. Take a look at github, create an account. Moreover, there is google code and tortoise svn alternative.
Related
I have an old eclipse android workspace which has the following structure:
one library project which has all the code and default graphics and resources
other projects which depend on the library project, but with different package names, different strings.xml and different graphic resources.
Basically what this means is that all my code is in the Library Project, and all other projects are really just different apps, based on the same code, but looking differently with different names
All these were in one Eclipse workspace and now I need to update the project, so upgrading it to Android Studio sounds like the best way to go.
The easy way is to hope that export works for your case. I battled with Eclipse->Studio migration for weeks. I had exactly that situation - one common project and other apps on top of it. Studio will just convert your common project into an Android library module, and other 'app' modules will be converted into Android app modules. Check out this answer: https://stackoverflow.com/a/22797387/2102748
When you're migrated, you should look to move your source files from the ant-style hierarchy to the gradle-style hierarchy. There is a lot of content for that here: http://tools.android.com/tech-docs/new-build-system/user-guide
Android Studio will also ask you to replace .jar libraries it knows about (like appcompat, google-play-services, etc) with gradle dependencies - do it. Life becomes so much easier.
I am building a new project which uses some Java class from my other projects. I just found a bug in one of my file and I have to fix it everywhere.
Is there a way or best practices to solve this issue.
I have now these projects:
Project A (game)
Project B (game)
Project C (tutorial app)
in each projects I have these common classes:
Settings.java
Progress.java
Now I copy these files to each projects. All these files are identical and other than the bug I just found, I do not have to change them.
Thanks
How about making your own Android Library Project and linking to it from the projects where you are willing to use it.
Here, take a look. Explanation of different kind of projects you can create.
So I recently migrated to Android Studio from Eclipse. For the most part, it's better, but I haven't found a good way to maintain a shared codebase between multiple projects.
What I want to do is be able to share some code between several of my applications. Each application is in its own project. From what I've seen, most people add it as a library module in the application's project. The problem with that is the module is accessible from only one project. The other projects within which my other applications reside can't access the library.
It seems to me like there should be a mechanism for creating another library project and then allow each of the application projects to access that code. This worked in Eclipse, where I would create another project in my workspace, mark it as a library, and then have the other projects reference it. I would be able to change the code in the library and then all of the projects referencing it would automatically build with the updated code.
Is this something I could do in Android Studio?
Yes this is possible:
Create the project you would like to have as a shared library - we'll refer to it as sharedProject.
Now in the project that you want to use this library open settings.gradle and paste the following:
include '..:sharedProject:app'
Open your build.gradle and paste the following under the dependencies element:
compile project(':..:sharedProject:app')
You can use this technique for as many projects as you'd like to refer to your common codebase in sharedProject. Note that this assumes your project and your sharedProject directories are in a common workspace directory (which is almost always the case).
I find a git project that claims to be able to do MultiAutoCompleteTextView GMail style. But when I download the project and open it in eclipse as android project from existing source it does not work. What am I missing there? Has anyone successfully run the project?
Normally, a git project is something you can clone/download and run as is and then try to modify for your own devise. Is this one different?
https://github.com/splitwise/TokenAutoComplete
Looks like AndroidStudio project (IntelliJIdea). It won't open in eclipse, but you could create a new eclipse project and use the code as source anyway.
This is my project. We've been using it internally at Splitwise for a while and there are a number of other people using it as well. I've just been using Android Studio, so the whole project is based on the current best practices for that (using gradle for builds/AS friendly project structure). I don't use Eclipse and haven't had any pull requests to support Eclipse better, so we're bad on support for that.
That being said, you can grab a packaged jar file from the releases page (https://github.com/splitwise/TokenAutoComplete/releases) and add that to your project pretty easily.
The code is also just two files here: https://github.com/splitwise/TokenAutoComplete/tree/master/library/src/main/java/com/tokenautocomplete
You can probably just grab the TokenCompleteTextView.java file and edit the package structure to put it in your project directly if you want to mess with the code.
I am building series of android projects with almost the same classes, only some sources like images are different.
I want to make it like a source or library, so that I can create projects by only referring to that source/library, inherit the class, and put in images.
For example, I create a project call "Prototype", which is the template. Then I build new projects, adding "Prototype" in Build Path -> projects. Then I extend the classes in "Prototype", it compiles. But when I run it, it says "Could not find Prototype.apk!"
Am I doing correctly? Or I need the Prototype.apk? If so, where should I put it?
Are you using Eclipse as the IDE for your Android projects? If so, you can create library projects as described in: http://developer.android.com/tools/projects/projects-eclipse.html
You can then use a library project as your Prototype.