Using build types in Gradle to run same app that uses ContentProvider on one device

后端 未结 14 1035
小蘑菇
小蘑菇 2020-11-28 00:22

I have set up Gradle to add package name suffix to my debug app so I could have release version that I\'m using and debug version on one phone. I was referencing this: http:

14条回答
  •  借酒劲吻你
    2020-11-28 00:47

    I would rather prefer a mixture between Cyril and rciovati. I think is more simplier, you only have two modifications.

    The build.gradle looks like:

    android {
        ...
        productFlavors {
            production {
                packageName "package.name.production"
                resValue "string", "authority", "package.name.production.provider"
                buildConfigField "String", "AUTHORITY", "package.name.production.provider"
            }
    
            testing {
                packageName "package.name.debug"
                resValue "string", "authority", "package.name.debug.provider"
                buildConfigField "String", "AUTHORITY", "package.name.debug.provider"
            }
        }
        ...
    }
    

    And the AndroidManifest.xml:

    
    
        
    
            
    
        
    
    

提交回复
热议问题