Git Product home page Git Product logo

modularizationproject's Issues

Fragment 如何模块化?

例如微信那样的布局,4Tab的都是fragment填充,如何组件化?我看了一些组件化的文章都是以Activity为单位进行,而实际开发中往往是一个Activity带几个Fragment

资源冲突

Error:Execution failed for task ':NewHouseModule:processDebugManifest'.

Manifest merger failed : Attribute application@label value=(@string/new_house_app_name) from AndroidManifest.xml:8:9-51
is also present at [com.github.BaronZ88:Retrofit2-FastJson-Converter:1.2] AndroidManifest.xml:13:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:5:5-20:19 to override.

建议

你好,关于 Lib Module 的 sourceSets ,我觉得通过 Gradle 的 productFlavors 来完成比较好点。

publishNonDefault true
    flavorDimensions "mode"
    productFlavors {
        app {
            dimension "mode"
        }
        lib {
            dimension "mode"
        }
    }

在 App Module 中通过指定 productFlavors 来依赖

if (!isDebug.toBoolean()) {
        compile project(path: ':business1', configuration: 'libDebug')
        compile project(path: ':business2', configuration: 'libDebug')
    } else {
        compile project(':basicbusiness')
    }

这样做有个好处是,可以在不同 productFlavors 对应的目录下放置属于各自的资源或者 Java 文件,让 Gradle 自动去合并。一来不用完全拷贝两份 AndroidManifest.xml ,只需要改下特定的部分,放在 src/app/ 目录下的 AndroidManifest.xml,通用部分放在 main 目录下的 AndroidManifest.xml。第二,不会将多余的资源文件打包进去,比如有些文件只需要在 Module 作为 Application 的时候需要的。

我最近也在做这个模块化,组件化的事情,希望能一起探讨下。

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.