erl*_*man 5 android android-instant-apps android-architecture
我正在关注其中一个用于制作即时应用的Google Codelabs.
我正在尝试创建topeka-ui(即时应用程序的UI功能模块).
当我尝试运行其中一个即时应用程序模块时,它说:
已定义依赖功能,但未设置包ID.您可能缺少基本功能中的功能依赖项.
Dam*_*ehy 32
我有一个问题,我有一个 Android 应用程序和一个 Android 库,但我错误地使用了错误的插件。
对于应用程序:
plugins {
id "com.android.application"
id "kotlin-android"
}
Run Code Online (Sandbox Code Playgroud)
对于图书馆:
plugins {
id "com.android.library"
id "kotlin-android"
}
Run Code Online (Sandbox Code Playgroud)
tim*_*etz 21
由于这是“定义了依赖功能但未设置包 ID。您可能缺少基本功能中的功能依赖项”的唯一 stackoverflow 问题。我将回答我的问题在这里而不是创建一个新问题。我有一个模块给我这个错误,但无法找出问题所在。在依赖模块的 build.gradle 文件中,我有:
apply plugin: 'com.android.feature'
Run Code Online (Sandbox Code Playgroud)
本来应该是:
apply plugin: 'com.android.library'
Run Code Online (Sandbox Code Playgroud)
小智 13
您可能已将依赖模块添加为应用程序,应将其添加为库。检查模块的build.gradle文件并
代替
plugins {
id 'com.android.application'
Run Code Online (Sandbox Code Playgroud)
到
plugins {
id 'com.android.library'
Run Code Online (Sandbox Code Playgroud)
如果 applicationId 添加到 defaultConfig 块中,还可以从内部模块的 build.gradle 中删除 applicationId
小智 9
我在 build.gradle(...mylibrary) 中完成了它,修复了它并且它起作用了:
plugins {
- id 'com.android.application'
+ id 'com.android.library'}
defaultConfig {
- applicationId "com.example.mylibrary"
minSdk 21
targetSdk 32}
Run Code Online (Sandbox Code Playgroud)
我刚刚在AS 3.0 beta 2上运行了codelab而没有问题(*note).在codelab中你的问题出现之后?
你可能错过了一步.仔细检查基础模块的build.gradle是否具有:
dependencies {
...
application project(":topekaapk")
feature project(":topekaui")
}
Run Code Online (Sandbox Code Playgroud)
退出feature project(":topekaui")可能会导致此错误:
错误:com.android.builder.internal.aapt.AaptException:已定义依赖功能但未设置包ID.您可能缺少基本功能中的功能依赖项.
注意:由于已禁用非基本模块的数据绑定(https://issuetracker.google.com/63814741),因此在多功能步骤7中需要一些额外的步骤来绕过它(即摆脱它)的DataBindingUtil).
| 归档时间: |
|
| 查看次数: |
2742 次 |
| 最近记录: |