生成失败,返回';任务:功能:目录:CreateDebuggCompatibleScreenManifests失败';在android上重构到动态功能模块时
一旦我将动态功能模块引入我的应用程序,我就能够成功地重构功能一(订单)、构建和部署。但在重构第二个模块时,即将文件和资源移动到该模块时,我在构建时遇到以下错误:生成失败,返回';任务:功能:目录:CreateDebuggCompatibleScreenManifests失败';在android上重构到动态功能模块时,android,gradle,android-manifest,koin,dynamic-feature-module,Android,Gradle,Android Manifest,Koin,Dynamic Feature Module,一旦我将动态功能模块引入我的应用程序,我就能够成功地重构功能一(订单)、构建和部署。但在重构第二个模块时,即将文件和资源移动到该模块时,我在构建时遇到以下错误: Execution failed for task ':features:catalog:createDebugCompatibleScreenManifests'. > Failed to calculate the value of task ':features:catalog:createDebugCompatibleS
Execution failed for task ':features:catalog:createDebugCompatibleScreenManifests'.
> Failed to calculate the value of task ':features:catalog:createDebugCompatibleScreenManifests' property 'applicationId'.
> Failed to query the value of property 'testedApplicationId'.
> Collection has more than one element.
我尝试了以下修复:
applicationId
bit)manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:name="android.hardware.camera2"
android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".ExampleApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${crashlyticsCollectionEnabled}" />
<activity android:name="com.kyosk.app.ui.fragment.login.LoginActivity" />
<activity android:name="com.kyosk.app.ui.activity.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.kyosk.app.ui.activity.Home" />
<service
android:name=".service.MessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".location.services.LocationUpdatesService"
android:exported="false" />
<service
android:name=".location.services.MapsLocationUpdatesService"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.example.app.orders">
<dist:module
dist:instant="false"
dist:title="@string/title_orders">
<dist:delivery>
<dist:install-time />
</dist:delivery>
<dist:fusing dist:include="true" />
</dist:module>
</manifest>
功能模块1(订单)manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:name="android.hardware.camera2"
android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".ExampleApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${crashlyticsCollectionEnabled}" />
<activity android:name="com.kyosk.app.ui.fragment.login.LoginActivity" />
<activity android:name="com.kyosk.app.ui.activity.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.kyosk.app.ui.activity.Home" />
<service
android:name=".service.MessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".location.services.LocationUpdatesService"
android:exported="false" />
<service
android:name=".location.services.MapsLocationUpdatesService"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.example.app.orders">
<dist:module
dist:instant="false"
dist:title="@string/title_orders">
<dist:delivery>
<dist:install-time />
</dist:delivery>
<dist:fusing dist:include="true" />
</dist:module>
</manifest>
从emulator卸载应用程序,然后重新启动它问题最终是我导入的库 库中有插件
apply插件:“com.android.application”
而不是
应用插件:“com.android.library”
因此,gradle构建任务正在清单中查找applicationId
和applicationName
,但清单中没有
哦,开发人员错误。对我来说,这是在添加具有多种风格的新动态功能模块时发生的 我通过改变模块内部解决了这个问题。gradle:
implementation project(path: ':app', configuration: 'default')
进入
然后将口味添加到模块中。gradle
flavorDimensions "app"
productFlavors {
flavor1 {}
flavor2 {}
flavor3 {}
}
apply plugin: 'com.android.dynamic-feature'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "app"
productFlavors {
flavor1 {}
flavor2 {}
flavor3 {}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(":app")
}
这是我的最后一个模块。gradle
flavorDimensions "app"
productFlavors {
flavor1 {}
flavor2 {}
flavor3 {}
}
apply plugin: 'com.android.dynamic-feature'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "app"
productFlavors {
flavor1 {}
flavor2 {}
flavor3 {}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(":app")
}
嘿我想这就是我要找的。你能再解释一下你做了什么吗?在动态模块中添加“实现项目(路径:':app',配置:'default')”会给我带来另一个错误:“集合为空”。。。谢谢!尝试使用这一行“实施项目(“:app”)”。如果你需要更多的帮助,告诉我@米奇高斯,你也犯了同样的错误吗?检查您在模块级build.gradle顶部应用的插件,确认其:apply plugin:'com.android.application'用于应用模块,应用插件:lib模块的“com.android.library”和动态模块的“com.android.dynamic feature”感谢您的回答,但最后我的问题是@Alex有点不同,因为我们的应用程序模块代码使用的是动态模块,我们应该在应用程序的渐变中有
实现项目(路径:':dynamic module')
。如果我们将实现项目(“:app”)
添加到模块的渐变中,它将创建循环引用错误,不是吗?