由于依赖性错误而未生成 apk
apk not generated because of error in dependency
下面是我的应用级别 gradle 文件。
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
}
在我添加最后一个依赖项之前,它工作正常。此后apk不再生成。
下面是构建输出
Manifest merger failed : Attribute application@appComponentFactory
value=(android.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
value=(androidx.core.app.CoreComponentFactory). Suggestion: add
'tools:replace="android:appComponentFactory"' to element
at AndroidManifest.xml:8:5-23:19 to override.
我尝试更改
com.google.android.gms:play-services-ads:19.0.1
到11.0.0
这帮助我生成了 apk,但警告说 'All com.android.support libraries must use the exact same version specifications (mixing versions can lead to runtime crashes)'
我完全不知道这一点,所以无法从其他此类问题中获得帮助并直接提出来。
如果我将它部署到 Playstore 上并带有该警告,可以吗?
或者有什么方法可以用“19.0.1”摆脱它吗?
在您的项目级别底部添加以下代码build.gradle
并同步您的项目
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "19.0.1"
}
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "28.0.0"
}
}
}
}
下面是我的应用级别 gradle 文件。
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
}
在我添加最后一个依赖项之前,它工作正常。此后apk不再生成。
下面是构建输出
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:8:5-23:19 to override.
我尝试更改
com.google.android.gms:play-services-ads:19.0.1
到11.0.0 这帮助我生成了 apk,但警告说 'All com.android.support libraries must use the exact same version specifications (mixing versions can lead to runtime crashes)'
我完全不知道这一点,所以无法从其他此类问题中获得帮助并直接提出来。
如果我将它部署到 Playstore 上并带有该警告,可以吗? 或者有什么方法可以用“19.0.1”摆脱它吗?
在您的项目级别底部添加以下代码build.gradle
并同步您的项目
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "19.0.1"
}
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "28.0.0"
}
}
}
}