How to centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:
root
  --gradleScript
  ----dependencies.gradle
  --module1
  ----build.gradle
  --build.gradle
In gradleScript/dependecies.gradle:

ext {
    //Version
    supportLibrary = '22.2.1'

    //Support Libraries dependencies
    supportDependencies = [
            design           :    "com.android.support:design:${supportLibrary}",
            recyclerView     :    "com.android.support:recyclerview-v7:${supportLibrary}",
            cardView         :    "com.android.support:cardview-v7:${supportLibrary}",
            appCompat        :    "com.android.support:appcompat-v7:${supportLibrary}",
            supportAnnotation:    "com.android.support:support-annotations:${supportLibrary}",
    ]
}
In the top level file build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

// Load dependencies
apply from: 'gradleScript/dependencies.gradle'
In the module1/build.gradle:

// Module build file

dependencies {
    //......
    compile supportDependencies.appCompat
    compile supportDependencies.design
}
Here you can find the full gist.

Thanks to Fernando Cejas and this blog.

Comments

  1. Very Nice Blog, You are spreading very good information among us… Yes Web Hosting plays very important role in business world. And it is important to have the best hosting services.
    Germany VPS Hosting

    ReplyDelete
  2. Looking for Homework Help In The USA? I recommend that you should try our academic writing services which you will never regret trying, we offer writing services under all niches and streams within your budget.
    Read More Blog : https://bit.ly/3wvY0n0

    ReplyDelete
  3. Nice tips... Much obliged for sharing this stunning and educative blog entry! That will be useful to anyone at all time. It shows how well you understand this subject. Thanks for sharing.Our Java Programming Training In Virginia for data science and Java Developers helps all developers to become better programmers.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. As you are sharing the article about Android Development & you are introducing us Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries. Yes! this blog is absolutely amazing!
    If you are looking for VPS Server & want to take full information about it, you can choose USA VPS Hosting . Here you get reliable VPS Server Hosting in the cheapest price. Don't worry about the security.

    ReplyDelete
  8. this blog is very amazing and informative i am very thankful to you share me How to centralize the support libraries dependencies in gradle ,Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries. if you want to know about server hosting or interested in best USA VPS Hosting you can ask us for more details and services.

    ReplyDelete
  9. Amazing blog! I am feeling grateful to read this. You gave a nice information for us. Yes Web Hosting plays very important role in business world. If you want to know about Server hosting ,I can help you USA VPS hosting Join and grow your business. please updating more stuff content...keep up!!

    ReplyDelete
  10. isc888 เว็บตรง แทงบอลสด, แทงบอลสเต็ป, บอลเต็ง, แทงบอลสเต็ป Live, แทงบอลเตะมุม, แทงบอลราคาพูล จากต่างประเทศ มีราคาบอลให้เลือกทั้ง ราคาบอลมาเลย์ ราคาบอลฮ่องกง ราคาบอลยุโรป นอกจากนี้ทางเว็บเราสามารถเลือกแทงบอล แบบ เต็มเวลา, 45 นาที และ 90 นาที และรูปแบบการแทงบอลอีกมากมาย.

    ReplyDelete
  11. ngobrol games Setiap layer yang bisa ditumpuk hingga delapan kali akan menambah 60 poin Physical Damage.

    ReplyDelete
  12. I am a regular reader of your blog and I find it really informative tnx for make a blog on How to centralize the support libraries dependencies in gradle ,Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries. If you want to know about server hosting or interested in best Italy VPS Hosting you can ask us for more details and services.

    ReplyDelete
  13. https://gamebegin.xyz You can training alone. A pitching machine permits you to set the pace of your tennis ball. By packing a number of baseballs into the machine, you may training hitting without needing a pitcher. This digital unit is great for those who wish to training baseball by itself. Pitching equipment could be acquired at the nearby showing off products retailer.

    ReplyDelete
  14. With the help of cheap assignment writing services, any student can get their assignments done at a reasonable price.

    ReplyDelete
  15. Excellent blog!!! I really enjoy to read your post and thanks for sharing!
    Spousal Support in Virginia
    Virginia Spousal Support

    ReplyDelete
  16. Nice blog I really inspired to read this blog, Thanks for providing. Improve your website's search engine ranking and increase your online visibility with the ultimate list of top guest posting sites.

    ReplyDelete
  17. "Different types of Non-Government Organizations(NGOs) Visit types of ngo in india.com!. in India - Learn about the various types of NGOs in India with this informative blog, which explores the different categories of non-government organizations."

    ReplyDelete

  18. "We are OSHA NRTL certification consultants and make certification easy for American and Canadian market. Get NRTL Certificate for USA / America now. Click here NRTL certification.com to know all about how to get an NRTL certification for USA and Canada."

    ReplyDelete

  19. Want to enter the Canadian market for telecommunication products? Click here Industry Canada Certification.com to know - how to obtain Industry Canada Certification easily? Get your IC Certification mark for Import- Export for Canada now from best consultants.

    ReplyDelete
  20. It integrates the healing power of sound vibrations with the benefits of massage therapy, creating a deeply immersive and transformative experience for recipients.

    ReplyDelete
  21. Anma Massage has evolved over centuries and is still practiced today as both a therapeutic modality and a form of relaxation.

    ReplyDelete
  22. Discover the benefits, find top-notch spas, and learn how to choose the perfect massage for your needs massage parlour near me

    ReplyDelete
  23. When relaxing massage strokes are applied the body is stimulated to release natural endorphins such as serotonin and dopamine.

    ReplyDelete
  24. Mayan abdominal treatment can often be safely integrated with conventional fertility treatments, but it's crucial to consult with the specialists at Fullblue Fertility. They can assess your unique situation and determine whether Mayan abdominal treatment is suitable and can complement your existing treatment plan.

    ReplyDelete
  25. Nice Blog! Your ctreativity is good and content is usefull. If yopu are looking for full stack development training in noida

    ReplyDelete
  26. Whether you're looking for a From various female to male massage near me techniques to ambiance considerations, we'll cover it all, ensuring you make an informed choice for a serene experience to relieve muscle tension

    ReplyDelete
  27. Brand Liaison provides complete support in EPR Registration by managing documentation and formalities in getting EPR Certificate.
    Documents Required for EPR Registration E-Waste
    EPR Authorization
    EPR Authorization is mandatory for all Producers, Importers, Brand Owners & Manufacturers of Electronics, Plastic Packaging, Batteries & Tyres in India. Team Corpseed Will Help you with the technical consultant on the applicability of EPR rules on your business and also help you with the documentation to acquire registration/Certification from CPCB

    ReplyDelete

  28. Thank you for sharing this Blog, This is more informative and nice.

    Testing tools Training in Hyderabad

    ReplyDelete
  29. You can get rid of fatigue, headaches, body aches and tiredness with our services. We also help you achieve a radiant skin. This service is offered at Spa in Chennai.

    ReplyDelete
  30. Aromatherapy is the application of essential oils from plants for relaxation and therapeutic effects. Aromatherapy can be used in male to female massages, or even the air. Our therapists have a high level of experience and are certified. You can relax while they care for your skin.

    ReplyDelete
  31. Great Blog
    Need a reliable assignment helper online? Assignment Helper offers top-notch assignment assistance for Malaysian students. Our experienced team is here to help you with all your academic needs, ensuring timely and high-quality submissions. Visit assignmenthelper.my today and take the first step towards stress-free learning. Let us help you achieve your academic goals with ease!

    ReplyDelete
  32. A nursing jobs agency in India facilitates the seamless connection between qualified nurses and healthcare institutions requiring their expertise. These agencies meticulously vet and verify credentials, ensuring that only the most competent professionals are placed in various medical settings. Specialized training programs are offered to enhance nurses' skills, preparing them to excel in their roles. Career counseling services guide nurses through their professional journeys, helping them make informed career choices. Regulatory compliance and documentation assistance streamline the hiring process, making it efficient and hassle-free. Leveraging extensive industry networks, these agencies ensure access to a pool of skilled and dedicated nursing talent. Their commitment to high standards significantly contributes to the overall quality and efficiency of the healthcare sector in India.
    https://dynamichealthstaff.com/

    ReplyDelete
  33. Shared hosting in India is an ideal solution for small businesses and individuals looking to establish an online presence without significant expense. This type of hosting involves multiple websites sharing a single server, which helps keep costs low. Key features typically include a user-friendly control panel, sufficient storage space, and adequate bandwidth to handle moderate traffic levels. Providers often incorporate security measures such as SSL certificates and regular backups, ensuring data protection. Additionally, shared hosting plans usually come with 24/7 customer support to address any technical issues promptly. Many providers also offer additional services like free domain registration and website builders, making it easy to get started. Overall, shared hosting presents an affordable and efficient option for hosting websites in India.
    https://onohosting.com/

    ReplyDelete
  34. Breast surgery prices in Delhi are influenced by the type of procedure and the healthcare facility chosen. Lumpectomies, aimed at conserving breast tissue while removing the tumor, range from INR 1.5 lakh to INR 2.5 lakh. More extensive mastectomies, which involve the complete removal of the breast, cost between INR 2 lakh and INR 4 lakh. Reconstructive surgery post-mastectomy can surpass INR 5 lakh. Private hospitals, especially those equipped with cutting-edge medical facilities, generally charge higher fees than government or charitable institutions. Additional costs for diagnostic tests, medications, and follow-up consultations further contribute to the financial burden. Comprehensive health insurance and thorough financial planning are essential to manage these substantial expenses effectively.
    https://www.breastoncosurgery.com/services/breast-cancer-treatment-cost-in-delhi/

    ReplyDelete
  35. Colon cancer treatment in Ahmedabad is renowned for its comprehensive and multidisciplinary approach. Specialists in the city utilize advanced diagnostic tools such as colonoscopies, CT scans, and PET scans for accurate detection. Treatment plans typically involve a combination of surgical intervention, chemotherapy, and radiotherapy, with cutting-edge options like immunotherapy and targeted therapy also available. Many of these specialists are affiliated with top multi-specialty hospitals, ensuring access to state-of-the-art medical facilities. Patient care is highly personalized, focusing on individual medical needs and holistic pre- and post-treatment support. Testimonials frequently praise the expertise, compassionate care, and successful outcomes provided by these specialists, solidifying their reputation in the medical community.
    https://drvirajlavingia.com/colorectal-cancer-specialist-in-ahmedabad

    ReplyDelete
  36. A breast cancer doctor in Mumbai is a specialist dedicated to diagnosing and treating breast cancer using the latest medical advancements. They work as part of a multidisciplinary team, tailoring treatment plans for each patient that may include mammography, biopsies, chemotherapy, and targeted therapies. These doctors emphasize patient education, helping individuals understand their diagnosis and treatment options. They are known for their compassionate care, aiming to preserve the quality of life while effectively managing the disease. Many are also involved in clinical research, contributing to innovative cancer treatments and better patient outcomes. Their expertise and commitment make them essential in the fight against breast cancer.
    https://drnitanair.com/about/about-top-breast-cancer-surgeon-mumbai

    ReplyDelete

Post a Comment

Popular posts from this blog

AntiPattern: freezing a UI with Broadcast Receiver

NotificationListenerService and kitkat