2
I added a new flavor in my Build.Gradle :: 
    productFlavors {
            pro{
                applicationIdSuffix ".pro" //newpackagename=com.example1.android.pro
               } 
                   }
    My android app structure:
       Project      
       |
        `-- res
             |-- drawable
                      |-- logo.png
       |
        `-- src
            |
             `-- com
                 |-- example1
                        |--- android
                                    |-- db
                                         |-- DatabaseHelper.java
                                         |-- DBObject.java
                                    |-- pro //created new package manually 
                                    |-- AppProperties.java
                                    |-- AndroidTimerFactory.java

But I want to start customizing the application for "Pro" and want to add a new logo.png for that package. How can I do that? where to add the new png image since it lies outside the src folder.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
ugola
  • 300
  • 3
  • 18

2 Answers2

0

Typically you would have folder under src for each product flavor and could then, in your example, store your flavor specific resources under src/pro/res

John O'Reilly
  • 10,000
  • 4
  • 41
  • 63
  • How to create a new res folder? Which option to select after selecting src/pro ->new->? – ugola Dec 18 '16 at 15:04
  • just create it like you would any other folder (e.g. in AS, right-click on `src` and do New/Directory)....you would then store your png file in `src/pro/res/drawable`. – John O'Reilly Dec 18 '16 at 15:06
  • I have done these steps and updated the new png. But how to run this version of build? ie the pro version ? – ugola Dec 18 '16 at 15:36
  • If you are using Android Studio, there's a "Build Variants" tab on left hand side you can select....you can then select build variant you want to use. If building using gradle then there will be set of standard tasks for each variant e.g. assembleProDebug – John O'Reilly Dec 18 '16 at 15:38
  • Yes I am using android studio. I selected Build Variants : then pro (Debug or Release? ) and then when I run the project, Error : The apk for your current selected variant is not signed. Please speficy the signing configuration for this variant ( when i selected release) Thank you SO much for helping me out! – ugola Dec 18 '16 at 15:52
  • Sounds like you're not fully setup to build/run release builds (need, as error mentions, info to sign the build). For the time being I'd suggest selecting debug (which is what you'd typically want until you to to point of publishing app) – John O'Reilly Dec 18 '16 at 15:54
0

Even if it lies outside the src folder it doesn't matter.Gradle will make sure that it is overriden while merging resources. Simply put the png file in src/pro/res/drawable/logo.png

Sukhmeet Singh
  • 130
  • 3
  • 13