Android 安装多个 app 同一份代码

 

apply plugin: com.android.application

android {
    compileSdkVersion 24
    buildToolsVersion 25.0.0
    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 22
        versionCode 80
        versionName "0.0.8"
        vectorDrawables.useSupportLibrary = true
    }
    sourceSets {
        main {
            jniLibs.srcDirs = [libs]
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile(proguard-android.txt), proguard-rules.pro
        }
    }
 productFlavors { // pro { // resValue ‘string‘, ‘app_name‘, ‘测试版‘ // applicationId ‘com.zhiqi.project‘//"com.smartcity.project" // }
 free { resValue string, app_name, 智慧苏尼特 applicationId com.smartcity.sunite } }
}

 

 

如果用了  FileProvider

        <provider
            android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths" />
        </provider>
FileProvider.getUriForFile(BaseApplication.getInstance(), BuildConfig.APPLICATION_ID, mAvatarFile);

参考资料:

http://m.blog.csdn.net/myth13141314/article/details/73616580