I'm not sure if I'm misunderstanding your question, but I'll try to take a crack at it. For my below explanation, I'll reference this code sample by Google several times. I HIGHLY suggest cloning that repo and playing around with it, since I think it will answer your question.
if we use libraries like dagger, butterknife, ... all modules would be dependent on other modules
As mentioned by others, any libraries that will be used by all of your Features will go into your Base Feature.
if our modules contain (views) as required, how should a transition to another view (from another module) be implemented without importing this module?
This answer covers the overview of it - but this part seems to be the root of your question so I'll try to dig in a little deeper.
Let's say Feature1 (BrowseActivity
) wants to open up Feature2 (ItemDetailActivity
). Instead of Feature1 calling startActivity(ItemDetailActivity.class)
directly, it will have to use the method call below (this is because Feature1 doesn't have access to Feature2's ItemDetailActivity.class
since they do NOT depend on each other).
Here is the code sample provided by Google
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://example.com/itemdetail"));
intent.setPackage(getPackageName());
intent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(intent);
Now the missing part is that in Feature2's AndroidManifest
you need to declare that ItemDetailActivity
is listening for the https://example.com/itemdetail
link. Here is the relevant code sample from Google
<activity android:name=".ItemDetailActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="example.com" />
<!-- IMPORTANT -->
<data android:pathPrefix="/itemdetail"/>
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.example.com/itemdetail" />
</activity>
For any more info, read up on Digital Asset Links as well as general Deep Linking