我正在尝试开发一个多功能即时应用。
我有query
和autocomplete
功能模块。
它们的功能模块中都有QueryApplication
和AutoCompleteApplication
类,用于依赖注入。
app
模块的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.epictimes.uvindex.app" />
“base”模块的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.epictimes.uvindex">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="aia-compat-api-min-version"
android:value="1" />
</application>
</manifest>
query
模块的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.epictimes.uvindex.query">
<application android:name=".QueryApplication">
<!--simplified-->
</application>
</manifest>
autocomplete
模块的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.epictimes.uvindex.autocomplete">
<application android:name=".AutoCompleteApplication">
<!--simplified-->
</application>
</manifest>
当我尝试构建时,它会给我以下错误:
``` 错误: 任务执行失败 ':base:processProductionDebugFeatureManifest'。 合并清单失败:来自[:query] AndroidManifest.xml 的属性 application@name value=(net.epictimes.uvindex.query.QueryApplication) 在 AndroidManifest.xml:16:9-68 中也存在于[:autocomplete] AndroidManifest.xml:14:9-82的value=(net.epictimes.uvindex.autocomplete.AutoCompleteApplication)。
建议:在AndroidManifest.xml:7:5-18:19的元素中添加'tools:replace="android:name"'以覆盖。 ```
应用模块中的合并清单也显示了错误消息。当我在`app`模块的清单中添加`tools:replace`规则时:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="net.epictimes.uvindex.app">
<application
android:name="net.epictimes.uvindex.query.QueryApplication"
tools:replace="android:name" />
</manifest>
它给了我一个类似的错误:
错误:执行任务失败 ':base:processProductionDebugFeatureManifest'。
合并清单失败:属性application@name的值=(net.epictimes.uvindex.query.QueryApplication)来自[:query] AndroidManifest.xml:16:9-68也存在于[:autocomplete] AndroidManifest.xml:14:9-82 value=(net.epictimes.uvindex.autocomplete.AutoCompleteApplication)。
建议:添加'tools:replace="android:name"'到 AndroidManifest.xml元素:7:5-18:19以覆盖。
但是这次应用程序、基础、查询和自动完成模块的合并清单没有显示任何错误。因此我认为这个错误是针对instantapp
模块的。
那么,如何为多功能即时应用程序组织应用程序类?
我们甚至可以为每个功能模块使用单独的应用程序类吗?