I'm using an external library to create a customized live streaming app.
Here is the library I'm using:
https://github.com/cine-io/cineio-broadcast-android/tree/master/cineio-broadcast-android-sdk
One of the (few) issues I have with this library is that it forces the phone to use the FRONT camera if there is one. I'd rather force to use the back camera (or have a choice, whatever).
As it is, the class that manages broadcasting in this library does have built-in public methods to choose the camera upon initialization, and its methods are private, so I can't extend it.
My solution has been to download the library locally, compile it as a local project in Gradle (I'm usnig Android Studio). Then I directly amend the library files in my project. It works.
However I'm worried this isn't a very good practice. One issue I can foresee is that the library will get upgraded - and since I'll have made changes locally it'll be very hard to take advantage of new versions of the library.
QUESTION: Is there a best practice when it comes to modifying external libraries? Is it what I am doing, or is there a better way?
Please feel free to provide feedback on the question so I can improve or clarify it as needed.
I would fork the library and push your commits to your fork. Like this you can later on merge changes in the original library to your fork as well.
GitHub has a great collaboration model, that allows you to fork any OSS project easily. You can modify it at will, optionally, push the changes back in a form of pull requests.
Once you have your code ready to build, you can use a full free continuous integration/distribution toolchain, that is built from a cloud-based CI server of your choice (Codeship, Drone.io, Travis-CI to name a few), a free instance of Artifactory for your SNAPSHOTs (intermediate build results) and Bintray as a distribution platform (built-in into Android Studio for other people reuse).
Here's a video demonstration of the full stack and here's the documentation of the Artifactory/Bintray part.
You can use reflection (https://stackoverflow.com/a/11484158) but it isn't a good way.
I think in your case it will be better to compile module from source and not to update it.
Related
I am working on a library that ideally will have a strictly-Java component and added functionality for Android-specific projects, with the intent to be most useful for Android apps, but also work with other Java apps.
But my question is: how should this be designed? I do not plan on needing resources, so I want to compile it into a JAR, but would I need to make two JARs, one of the Java stuff and another for the Android stuff? Or would a Java-only application be able to use a single JAR so long as it does not use the Android components?
If you make a library that uses pure java and does not use any android apis. It will work on both standard java and android java. However if the library uses any android apis it can't be used in a standard java project.
As far as I know, the JAR would be good for both types of aplications. It seems to mee that both JARs (just Java and android) are totally identical and thus equally compatible. If you don't use any of the android components, including Resources there should not be a problem at all.
You should still check whether you depend on libraries which are available on android and any normal Java distribution or -if not- either tell the user to preinstall the depending libraries or ship them whitin your JAR package and build path. Be carefull not to use libraries which are not available on android because the user has no or really few options to install them on himself.
What I don't understand is why you think your library is more usefull to android developers. I can not think of any example where this could happen. If the problem is really specific for android, you should consider developing the library android-only. If the problem is more general the lib will be usefull to all developers that might come to this problem, not just android.
I'm currently working on a project. I've been running into a few issues with the e-mail functionality, I've made multiple attempts to fix the issue and the latest seems to have fixed the issue.
For each rewrite I've created a new class to hold the new code. This doesn't seem to be the best solution as each time I have to go through the code and track down the references to the class and update them, with each rewrite only the code for the actual sending of the email has changed, function inputs and names have been consistent.
I've looked up versioning but this hasn't been particularly helpful in providing a solution either granted most likely due to my own lack of knowledge on the subject. So here is what I'm looking for: to have one instance of the class with multiple versions preferably without all the old code in it to aid in reading. But I want access to the old versions so that if a function/feature was there previously and wasn't built into the current version I can see how it was implemented.
Versioning is exactly what you need here.
Have a look here, which gives you a brief introduction to subversion, one of the most popular versioning systems. You can either set up / use your own private subversion server, or if you project is open source use a number of free providers (such as Google code) who will provide versioning for you.
Other versioning systems exist other than subversion, such as git, mercurial, etc. - but subversion is arguably the most popular and a good starting point.
Are you using any IDE? Eclipse/Netbeans store the history of your file updates and you can always compare/replace from history.
Note: This is not a replacement of version control in any way and I would highly recommend that you explore open-source version control solutions. This would help you in the long run
Mercurial is the way to go. Seemless merging and integration with java and popular IDE's like Netbeans. You can't go wrong. From the very beginning of my programming experience I learned how to use Mercurial in a day.
Use version management tool likes as SVN or CVS.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am working on a Java project together with a collaborator, and we are both using the Eclipse editor. What I want to do is to be able to share the .java files with him so that we can both edit it separately but see what has the other has written. Currently, I am doing this is an ad-hoc way by sharing a Dropbox folder that contains the project. However, this approach does not work well because he is using a different version of Java (as he runs a Mac while I am using Windows). For me to run the project, I would have to clear all the .class files that he has created which will appear on my computer since Dropbox just shares all the files.
I have heard of CVS as a way to manage file sharing among developers, but it sounds like a lot of work. I don't know for example how to get a CVS server or what to do to get it to work. Is there an easy and straightforward way to enable us to work together on the same Java project? Is GitHub the answer?
This is definitely the job of source control, as other answers have mentioned, Git or SVN are probably your best choices. Git is the newer one and is gaining a ton of popularity (probably thanks to GitHub).
GitHub is pretty easy to learn and can even take care of a lot of the more difficult tasks for you with their new GitHub for Windows client. They also have a GitHub for Mac client. Once you are more familiar with the tool you can get the EGit plugin for eclipse so you can control the source control directly from your IDE.
Additionally, GitHub created an online interactive tutorial for learning git.
As for clearing out class files (and also your .settings and .project and .classpath files from eclipse), you can instruct git to ignore these types of files using a .gitignore file. You can find templates for various languages (including Java) here.
you could spent the time to learn git at: https://help.github.com/articles/set-up-git
it's a very valuable tool and once you get used to it it will be very easy to share code.
Or better yet, Mercurial. It follows the same approach as Git, but is way simpler and works without hassle. To start a repository within the current directory, just run:
hg init
Have a look at the documentation for more information.
I recommend "Subversion"
Google it and look at the information.
You can easily check out files and check in.
I wish you luck.
Depending on what your future plans are the Git or Subversion would be fine. I finally made the switch to Git after years of using SVN.
Note that in addition to Github (which is great) there are also some other repository hosting services, some of which offer free "personal" accounts (most make your code public, but I think a few still give you a limited amount of space for free).
CVS is getting old and people are moving out of it to other source code control tools
The most famous tools are SVN and Git. There are other tools but less famous I believe
You definitly need a software revivision tool if you are going to work in a team(or even alone for that matters), as it marks the changes that have been made, when and by whom, etc...
google code for example offers an easy way to setup your svn repository in one minute. there are also alot of companies offers such a service online for free or for small money, depending on your need. So if you just need a sandbox, then setup a svn on google code and try it out
a code revision tool is almost a must for every programmer
good luck
is it possible to create java libraries the apps can use shared?
It is totally clear to me how to create a library project and how to use it while shared between several another projects, compile each project into different apps.
But in this case the library gets compiled into each app separated.
What I want is to create a library, compile it, install it into the device (or emulator) and several apps calling into this library.
And when it is needed to change something the apps use shard in this library, I just re-work the library, re-compile it, replace it on device (or emulator), and the apps use the new library, all apps use the new functions.
Is it possible?
I googled it, but I couldn't find the solution.
I am using Win + Eclipse, I can't use native code (since I know only Java).
Thanks
UPDATE: Thank you for your suggestions, I know about using Services and Activities started explicitly in order to share functionality.
I asked about libraries because I am investigating the possibilites. If there is no way to use common library, what is the purpose of uses-library... in the app manifest?
Thank you
It's more likely that you need a service as a library. Have you considered this possibility? You can create it as a separate application, define an interface for your service and use it in other apps. So as the interface does not change this will not influence on other apps that depends on this service.
The Android model installs each application as a separate user (UID) on the device and the users have no access to other application's/user's files. Therefore, you can't share libraries as such.
As Yury suggested, you might need a service or an activity that can be invoked from multiple applications.
Are there any frameworks out there which make it even more easy than it is to build Android applications and would you be interested in one?
Soon there will be!
I am working on DroidFu, an Android shared library which will give you:
tons of utility functions available directly in Activities (and Services), such as spawning list and error dialogs, checking for Intent availability, and other workarounds/replacements for cases where Android lacks desired functionality
easy handling of asynchronous tasks (takes care of resurrecting dialogs after orientation changes)
Easy XML parsing using a convention over configuration based XML pull parser
new adapters and widgets, such as as ListAdapterWithProgress (rendering a loading spinner as the last element when loading something) or a GalleryItem widget which will lazy load an image via a URL while rendering a spinner
an ImageLoader which can load images from the web asynchonously, backed by a FIFO cache, great for rendering avatars in lists and stuff
I plan to make this available on GitHub.
stay tuned.
update (Feb 2013)
Sorry to say that no one is working on this anymore. All people involved in the project have moved on, and since the lib was mostly used in the Qype app, no one feels like maintaining it anymore (Qype got acquired by Yelp btw, so I'm not even sure if we would be allowed to, since most of it was developed during my working hours at Qype.)
For anyone who feels like salvaging it, sources are here.
I just found out about App Dev Wiki. As described on its website:
This wiki is meant to collect links, tools, libraries, and anything
that is useful for mobile development.
Currently listed android frameworks are:
ignition
droid-fu
RoboGuice
Commonsware
ActionBarSherlock
Spring Android
DroidParts
One of the best right now IMHO is Appcelerator
Free and open-sourced, develop one app for all major platforms (cross-platform), compiles the app to native code, has a rich API...
I enjoyed playing with it.. very easy to learn :)
Hope this help!
P.S.: even though it sounds like I work there, I don't... unfortunately for me :(
Not really a 'software framework', but a tool to create simple apps easily (that's what Google says):
http://appinventor.googlelabs.com/about/
I don't use this tool since I'm not a big fan of this approach, but you could give it a try.
You can build many different types of
apps with App Inventor. Often people
begin by building games like MoleMash
or games that let you draw funny
pictures on your friend's faces. You
can even make use of the phone's
sensors to move a ball through a maze
based on tilting the phone.
But app building is not limited to
simple games. You can also build apps
that inform and educate. You can
create a quiz app to help you and your
classmates study for a test. With
Android's text-to-speech capabilities,
you can even have the phone ask the
questions aloud.
To use App Inventor, you do not need
to be a developer. This is because
instead of writing code, you visually
design the way the app looks and use
blocks to specify the app's behavior.
There's also phonegap, which you can use to write android apps using html+javascript.
http://www.motherapp.com/ apparently converts 'HTML' to 'applications'.
There are several frameworks of different scope and purpose to make mobile application development faster, or cross-platform, or code-free.
Technology thrives on competition and new ideas, so please don't take the presence of several other solutions as a deterrent from making your own if you think you can build a rounder wheel.
The Simple framework is fully compatible with Android. Its an annotated approach for XML serialization and data binding, and is fully bi-directional. So you can read or write XML on the Android platform. Whats more is its really lightweight and has no external dependencies. In essence its like a JAXB substitute for the Android platform. For more information check out the Tutorial.
To continue the list :
I am working on the BARACUS framework, which focus is to ease the pain of Android component development.
Current features:
Bean Container with Dependency Injection (type based on Interfaces or Implementations)
pure Java Configuration
Bean lifecycle management
Tiny OR-Mapper solution to have basic ORM w. lazy loading and automatic Row Mapping
Declarative form validation
Database hot backup and recovery
Automated database version management + automated migration
The library is available through maven central repository (including a maven archetype).
Also, a set of tutorials is available on blogstpot
The library is Apache2 licensed, open source (on github) and free usable in any projects (commercial+non-commercial).
I have completed developing an Android Framework for everyone to be able to use easily and quickly. I already developed several applications with that and it is called appFramework and as you can see, you will be using almost every feature and latest libraries in seconds with just extending or implementing the classes i have already created in the library. Setup process is already included, rest of using roadmap is up to you!
Already Created Classes of Features:
Google Map
Recycler View
Retrofit
Firebase Auth
RunTime Permission
CircleImageView
BottomBar
Tag Styled Picker
Right or Left Swipe Actioned Layout (FlingCard)
Material SearchView
AppCompatActivity
Drawer
Tag Activites of Fragments
ConfirmationDialog
Have a nice coding!