【发布时间】:2017-11-20 20:38:21
【问题描述】:
我正在尝试开发一个多功能的即时应用程序。
我有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'。
清单合并失败:属性 application@name value=(net.epictimes.uvindex.query.QueryApplication) from [:query] AndroidManifest.xml:16:9-68 也出现在 [:autocomplete] AndroidManifest.xml:14:9-82 值=(net.epictimes.uvindex.autocomplete.AutoCompleteApplication)。
建议:添加 'tools:replace="android:name"' AndroidManifest.xml:7:5-18:19 中的元素进行覆盖。
应用模块中的合并清单也显示错误消息。所以当我在app 模块的Manifest 中添加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 value=(net.epictimes.uvindex.query.QueryApplication) from [:query] AndroidManifest.xml:16:9-68 也出现在 [:autocomplete] AndroidManifest.xml:14:9-82 值=(net.epictimes.uvindex.autocomplete.AutoCompleteApplication)。
建议:添加 'tools:replace="android:name"' AndroidManifest.xml:7:5-18:19 中的元素进行覆盖。
但这一次 app、base、query 和 autocomplete 模块的 Merged Manifests 没有显示任何错误。所以我认为这个错误是针对instantapp 模块的。
那么,如何为多功能即时应用组织应用程序类?
我们甚至可以为每个功能模块使用单独的应用程序类吗?
【问题讨论】:
-
另外我认为我们不能为应用模块选择一个特性模块的应用程序类,因为其他特性的应用程序类也很重要。所以我认为我们应该为app模块编写一个单独的应用程序类。
-
如果我理解正确的 URL github.com/googlesamples/android-instant-apps/tree/master/… 可能会帮助你。
-
@PragatiSingh 该示例是多功能的,但不包含任何应用程序类(扩展应用程序的类)。我的项目是here如果你想看看
标签: android android-instant-apps