This project shows how to use Build Types and Product Flavors in Android. It helps you create different versions of your app (like Free and Paid) with specific features, libraries, and logic.
- Build Types:
- Use different settings for Debug and Release versions.
- Product Flavors:
- Create versions like Free and Paid with different features.
- Flavor-Specific Libraries:
- Add libraries only for a specific version.
- Flavor-Specific Logic:
- Write code that works differently for each version.
src/
├── free/
│ ├── java/
│ │ └── com/osama/flavors/FreeAction.kt
│ │ └── com/osama/flavors/FreeFeature.kt
├── paid/
│ ├── java/
│ │ └── com/osama/flavors/PaidAction.kt
│ │ └── com/osama/flavors/PaidFeature.kt
├── main/
│ ├── java/
│ │ └── com/osama/flavors/MainActivity.kt
│ │ └── com/osama/flavors/FlavorAction.kt
-
Clone the repository:
git clone https://github.com/your-repo/Flavors.git cd Flavors -
Open in Android Studio.
-
Select Build Variant:
freeDebugfor the Free version.paidDebugfor the Paid version.
-
Run the app.
- Free Version:
- Logs feature usage using Play Services (example logic).
- Paid Version:
- Simulates API calls using Retrofit and Gson.
If you like the project, don't forget to give it a ⭐ on GitHub!
Enjoy! 🚀