Gradle: How to merge Android manifest files for different buildTypes which need the same Activity, but with different intent-filters

后端 未结 3 1283
野趣味
野趣味 2020-12-05 05:47

so I\'m trying to use gradle to create a separate buildType, but that buildType needs to use different characteristics for the same Activity. In this case, my splash activit

3条回答
  •  借酒劲吻你
    2020-12-05 06:15

    Let me post a full solution that works. In this case, the application manages intent filters for both images and videos. However, for a particular flavor, we only want to capture videos, not images.

    Say your activity is defined like this:

    
    
        
            
            
        
    
        
            
            
        
    
    

    For your flavor named myFlavor, that I assume you already have, you have to have this in your AndroidManifest.xml file:

    
    
    
        
            
            
        
    
    

    Sync with Gradle, and check the final manifest, that is usually in myApp/build/intermediates/manifests/full/myFlavor/debug/AndroidManifest.xml

提交回复
热议问题