GithubHelp home page GithubHelp logo

majiake's Introduction

马甲壳打包


所谓马甲壳打包实则为多渠道打包,主要体现是同一套代码打包成多个app,各个app拥有自己的应用名、应用包名、应用启动图标等

如何实现


1.在gradle子节点productFlavors中配置渠道版本(关于多渠道打包详细介绍请自行了解,本例只做为一个基本介绍)

applicationId 设置包名

manifestPlaceholders 设置AndroidManiest.xml中变量

2.移除defaultConfig中的applicationId,同步项目(sync project),这个时候在Build Variant中就生成多渠道对应的版本

3.在src目录下新建一个以渠道版本名的文件夹,并添加资源文件(因为Android在编译打包时会将渠道版本下的资源文件一同打包,而引用资源文件时会优先引用渠道版本下的资源文件,和res引用资源文件类似),从而达到控制渠道版本特有样式

(ps:渠道版本特征有多种实现方式,这里只介绍本人觉得比较便捷、浅显易懂方式)

效果

majiake's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.