문제

I have an existing Android application.
I would like to extract another application from that existing one, so that it contains only a certain subset of the original Activities.

What would be the best way/approach for that?

The two applications will be actively maintained simultaneoulsy, so what would be the optimal way so that there is the less overhead possible?
My development environment is Android Studio + gradle...should I just create another variant?..and from that point on, should I just define the source folders? Can I just change the AndroidManifest and use a subset of the original activities?
Thanks

도움이 되었습니까?

해결책 2

The approach I followed eventually was to create a new variant like this:

flavorGroups "features"
productFlavors {
        normal {
            flavorGroup "features"
        }

        stripped {
            packageName "other.package"
            flavorGroup "features"
        }
}

And I just changed the activity transitions by sending diffent intents from each variant (I created separate source folders for each variant i.e.

src/main, src/stripped, src/normal etc.

I believe this was the fastest approach and has the advantage of being able to customize small parts in the common activities, rather than having an extracted library project and having two copies of the same activity just for a small customization.

다른 팁

Probably the best you can do is to extract the common parts (in this case, Activities) of your apps into a library project, then, if you need specific behaviour in your concrete apps, just subclass from the common classes to fit your needs.

http://developer.android.com/tools/projects/index.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top