- Open Source Your Android Code — The Complete Guide
- ADA | Adam Deconstructs Android
- Implementation
- Place code inside an Android Archive Library (AAR) — Step 1 of 6
- About
- Implementation
- Publish library publicly on GitHub with licensing and Docs — Step 2 of 6
- Bintray and Sonatype Setup — Step 3 of 6
- Bintray Implementation
- Sonatype Implementation
- Prepare Project for Upload — Step 4 of 6
- Prepare Library Module With Bintray
- Upload to jcenter— Step 5 of 6
- Why is jcenter better than maven central?
- Implementation
- Use In Project — Step 6 of 6
- Resources
- 7 Free Open Source Android App Source Code Websites to Download Android Codes
- #1 Wikipedia
- #2 SourceForge
- #3 GitHub
- #4 F-Droid
- #5 Google Android Sample Source Code
- #6 Fossdroid
- #7 XDA Developers
Open Source Your Android Code — The Complete Guide
ADA | Adam Deconstructs Android
Aug 29, 2017 · 8 min read
9/17/17 Update: JitPack.io appears to be a fast and easy alternative to open source Android code vs. the method below by integrating directly with GitHub. I have not tested JitPack so please share your feedback in the comments if you’ve implemented it.
You’ve spent hours building cool shit. What’s the next step? By open sourcing your work you’ll (hopefully) provide valuable code to the Android community, receive constructive feedback, and collaborate on building something better than what you originally had.
The current state of open sourcing for Android is unintuitive, involving integrating multiple services, waiting for manual approvals, and before this post, spending hours Googling obscure steps. That’s why I created a beginning-to-end guide to expedite the process.
The more open sourced code, the better.
Implementation
I will walk through each step of how I open sourced a CustomRippleView library for Android.
Place code inside an Android Archive Library (AAR) — Step 1 of 6
Besides open sourcing, AARs are useful when building multiple apps or versions with the same components.
About
- Structurally the same as an Android app module
- Includes source code, resource files, manifest (unlike JAR)
- Compiles into Android Archive (AAR) rather than into APK
- Post to some maven repository where devs can pull it as a dependency through Gradle (can also convert an app to a module)
- Code Overlap — The app module will take precedence over a library if a resource ID is defined in both, library defined first will take precedence between libraries.
Implementation
If you’re creating a standalone library outside an existing app you’ll want to both create a new project to host the library module as well as test the library module in an existing app.
1. Build the open sourced library module in an existing project so that you can test the code as you go.
a) Create library module
Click the plus or File > New > Module > Android Library > provide unique Library Module Name ( customrippleview)
b) Ensure local library module shows in project and compile local library in the app module.
build.gradle ( app module)
Add tools:replace=”android:name” to the app module’s Manifest file.
2. Create a new Android project to host the open source code by itself so that it can be uploaded to bintray
Create the default app module with app following the name ( customrippleviewapp) to differentiate the app module name from the open source library module we’ll create in the next step.
- Application name: CustomRippleViewApp
- Company domain: com.ebay.customrippleviewapp ( needs to be a domain you own in order to get approved for open sourcing)
- Package name: com.ebay.customrippleviewapp
3. Add your library module (refer to step 1A above)
4. Place the open source code inside new library module created
5. Remove original app module
Right-click on app module > Open Module Settings > remove original app module.
6. Choose resources to make public (Optional)
All resources default to public: By declaring at least one resource public it makes the rest private
res > values > public.xml
Publish library publicly on GitHub with licensing and Docs — Step 2 of 6
Apache License 2.0 is one of the most popular, similar to the MIT License, but provides grant of patent rights from contributors to users. Apache 2.0 is commonly found in Android, Apache, and Swift.
Make sure library module ( customrippleview/) and build.gradle are not in the ignore list list and edit .gitignore to only contain library module files added.
Bintray and Sonatype Setup — Step 3 of 6
You only need to go through this painful steps once to setup your bintray account. Praise the lord! As this isn’t difficult, but the most annoying step.
Bintray Implementation
2. Create new repository
a) Add New Repository → Type: Maven → Default Licenses: Apache 2.0
b) Use lowercase naming convention: customrippleview
3. Enable auto signing
Enter Repository → Edit → General Settings → select GPG sign uploaded files automatically
a) Generate keys (Only done once for bintray account)
In terminal for project:
Fill in Real name, Email address, and passphrase. If command does not work, run following command to install gpg and retry the command above.
View keys created
Upload the public key to keyservers. Call the following command and replace PUBLIC_KEY_ID with value after 2048 in the pub line.
Export both public and private key.
Enter your passphrase when prompted for private key.
Copy and paste public and private keys into bintray: Under profile Edit > GPG Signing. Make sure to copy and paste from beginning and end tags or else bintray will not accept the keys.
Sonatype Implementation
This step requires filling a Jira ticket. If you thought you could escape Jira in your free coding time, you’re mistaken. It’s not too bad, as both times I’ve submitted a ticket they’ve approved it within the same day.
3. Provide bintray your Sonatype OSS username
In your bintray profile Edit > Accounts > Sonatype OSS User: _____________
Prepare Project for Upload — Step 4 of 6
Prepare Library Module With Bintray
1. Add Jcenter and Maven dependency
Add to project’s build.gradle (not app or library build.gradle)
2. Define your bintray username, api key, and GPG Passphrase.
This info should be secure, which is why we’re adding it to local.properties which should not be tracked in GitHub as it is commonly ignored at the start of an Android project in the .gitignore file.
3. Add repository information and build scripts
Update library’s build.gradle with repository information and add scripts for building library files and uploading the built files to bintray.
4. If using Kotlin in your code, disable Javadocs in library’s build.gradle
Upload to jcenter— Step 5 of 6
Why is jcenter better than maven central?
- Delivers library through CDN → faster loading
- Largest Java Repository on earth
- “Friendly” UI (perhaps in comparison)
Implementation
1. Upload to bintray/jcenter (Once Sonatype Open Source Project Repository Hosting request is approved)
Expected Result: BUILD SUCCESSFUL
Expected Result: BUILD SUCCESSFUL
I kept getting the BUILD FAILED response when attempting to upload. After many hours cursing at my terminal I realized even with this message, the package was being uploaded, so check the bintray package UI.
2. Sync to Jcenter for easy one line implementation in Android
3 hrs — How is this not automated too?!
a) Under the uploaded package settings select Add to JCenter
b) Select Host my snapshot…, fill in group id for package, and Select Send
Once approved, you’ll receive an email.
In the meantime you can check by searching on bintray which will also show when your package is hosted.
3. Maintaining library
Linking to jcenter only needs to be done once. Moving forward, any package changes (updates, deletes), will be reflected in jcenter 2–3 min later.
- Updates: Change the libraryVersion in library module and re-upload using Step 5, part 1.
- Deleting: Remove each version from bintray before removing the entire package.
Use In Project — Step 6 of 6
Declare the library in gradle and call the desired files.
build.gradle ( app module)
- Group_Id — com.ebay.customrippleview(package name followed by group name)
- Artifact_Id: customrippleview
- Version: 1.0
Resources
- JitPack.io — JitPack is an Android specific open sourcing solution that appears to work seamlessly with GitHub repositories. For a premium, JitPack also provides private library hosting. I haven’t given it a try, but thanks to Rakshak and Vikarti for calling it out in the comments below!
- The Cheese Factory Blog — How to distribute your own Android library through jCenter and Maven Central from Android Studio. BIG thanks! There were details that changed since this was published in 2015, but it was a great place to start.
- Android Studio — Create an Android Library
- bintray
- sonatype
- sonatype — request to host new open source project ( only works when logged in to sonatype)
- bintray documentation — Including your Package in JCenter
- CustomRippleView GitHub sample and JCenter hosting
I’m Adam Hurwitz — hit the clapping hands icon and check out the rest of my writing if you enjoyed the above | Thanks!
Источник
7 Free Open Source Android App Source Code Websites to Download Android Codes
Are you beginners in android application development? learning development from Android books? Looking for FREE android app source code to test and built sample application? you are at right place! here we have manually review and tested various android application source code and listed for your reference.
Android’s SDK (Software Development Kit) has been helping several developers, brands and organizations come up with unique apps and achieve high quality results and tremendous efficiency. The primary advantage of free android app source code (open source codes) is the high level of coordination and collaboration developers can achieve while developing new apps on android platform. The SDK inherently provides a wide variety of materials, including tutorials, extensive documentation, samples, best practices and a continuously growing array of tools. Open source software developers have always been motivated by several factors, but quality stands as the noticeable point of focus. If you are an AR or VR developers, you can also find various AR SDKs available in market to start with.
On internet you will find many mobile apps market place where developers can buy & sell their source code online and later re-skin the application based on requirements.
Android’s free open source community has always attracted highly motivated and bright professionals, who in-spite of being rather unpaid/underpaid, maintain the standards and discipline of the community. They have been the minds behind most complicated bug fixes and other enhancements that bring about a stark difference in the quality and usability of an app. For the individual developer, the community has been increasingly providing with source code that match new product features and design efficacy. Further, free and open source codes have the compelling advantage of pricing, apart from reducing the monotony of the job.
The popular reasons behind the growing use of free Android open source codes by developers includes:
- Security: Free open source codes are highly scrutinized for their standards and a basic advantage is the high level of security you get. When a community of developers has accesses to lines of codes, there are more chances of any flaws to be detected, reported and addressed quickly. For free open source code developers, it is both money and credibility at stake and they give in their best.
- Quality: Again, the higher standards put forward by the Android community ensures that only the highest quality of source codes is made available. However, it does depend on where you borrow your source codes from. If you have been following a reputed/popular platform (examples come later in this article), you are most likely at an advantageous position.
- Customization: Customization is among the base reasons why app developers are looking for source codes. They don’t want to spend time of the basic scripting but focus more on the unique features and designs that they are supposed to develop. For example, the source codes for most ecommerce apps remain the same. It is the customization that allows the developer to come up with a completely new platform.
- Cost: Most open source codes are available either for free or at a minimal price. For the source code developers, the number of downloads acts as a calculator in their portfolio, while end users of the source code can have the basic structure of their script readily available and at a minimal price.
- Saves time: Finally, using free open source code saves a lot of time and allows you to focus all resources on the unique offerings of the apps. That’s the best way to stand against competition.
Recommended sources to download free Android app source codes
Table of Contents
#1 Wikipedia
As always, we can look up to Wikipedia for the best websites to download free open source android app codes. Wikipedia too is a community managed platform and this list is contributed by developers who have been using open source codes for Android apps for quite a while now. The list here is highly categorized and depending upon the genre of the app, you can choose among the most recommended options. There a detailed list, along with the licenses in categories like Ad Blocking, General Communication, Back up & Security apps, browsers, emulators, gaming apps, navigation apps, reading apps, utilities, multimedia, security and general apps.
#2 SourceForge
SourceForge(dot)net is an unique platform which hosts source codes from all different technologies and can be available for you to download the same. You can also download free android app source code from SourceForge where around 45+ android app codes available at the time of writing this post.
#3 GitHub
GitHub does not really require any introduction as it is one of the best source code repository platform being used by most of the software development team. If you are new in Android app development and looking for free demo source code to start your development learning practice, GitHub provides best resource for android beginners. Here are few sample android source code you can download from GitHub:
- Beginner Android Samples
- Custom ArrayAdapter Demo
- Book Library Search Demo
- ImageLoading and SQLite Demo
- Rotten Tomatoes Demo
- Styled ActionBar Demo
- Animations and Gestures Demo
- Custom Views Demo
- Services and Notifications Demo
- Audio and Video Demo
- Menus, Popups, and Fragments Demo
- Google Maps Demo
- Android Snake Game
Here the new addition to this GitHub android app source code resource is compiled by MyBridge. They have carefully compiled the list of 38 amazing open source android application source code which are built in JAVA language. According to their official announcement, they have used MyBridge AI algorithm to evaluate the quality of these source code. They have compared over 8200 app source codes and categorized them into 13 different groups. This list will definitely help you to find helpful source codes which can sharpen your android app development skills for sure.
#4 F-Droid
Another exciting platform featuring loads of open source codes for android apps, F-Droid had been a favorite among android developers. The platform gets contributions from all kinds of developers looking to put their mark across the internet and the world of smartphones. F-Droid is a non-profit organization and you will find lots of free and open source software for Android platform.
On F-Droid developers will find free source code for popular Android games & applications.
#5 Google Android Sample Source Code
Google itself provides sample source codes in different categories of android applications for you to start your android application development learning. The source also provides a host of tutorials that will help budding developers learn more about android coding and its platform versions. Hosted at https://developer.android.com/samples/index.html, Google samples source code for Android app can be your best companion in Android app development learning.
#6 Fossdroid
Another vast collection of open source codes reside at Fossdroid. More than 1000 source codes are spread across categories like application development, community apps, navigation apps, security apps and android games. As per Fossdroid team they take data from F-Droid source and organized very well on website that visitors can get basic ideas about app source code type, category and other important attributes. On Fossdroid users can also view apps based on its popularity and when it was uploaded.
You might even be able to get specific source codes for your new android comics, sports & health app, brain twister apps, travel demos, and other sub-categories in communication, finance, ecommerce, multimedia, gaming, community and more.
#7 XDA Developers
A growing community of Android app developers, this is where all you source code related queries and search will be answered. Among the biggest repositories for free open source codes, XDA Developers provide scripts, discussions, tutorials and tools for high quality app development. This is a must for any kind of developer, regardless of his/her experience. Afterall, market trends are changing and it is as a community that we can grow ourselves.
Android is among the most popular operating system today, based upon the penetration and usage. It is expected to keep its 85% of all smartphones market by 2020. With over 2 million apps in the Google’s Play Store, it is the first choice for businesses looking to make a mark among the general user base. An interesting thing to note here is that more than 70% apps in this store available for free, showcasing its popularity among brands and developers.
However, coming up with an app that will make a mark among thousands of similar platforms is not an easy task. Businesses put in a lot of resources, including time and money. Open source codes are the answer to any developer trying to focus on the unique capabilities of his/her app rather than writing down the same boring lines of monotonous codes.
Источник