它显示清单合并错误,尽管我的清单实际上是正确的
这是我的应用模块gradle依赖文件
CloseableHttpClient client = HttpClients.custom()
.build();
HttpClientContext clientContext = HttpClientContext.create();
try (CloseableHttpResponse response = client.execute(new HttpGet("http://google.com/"), clientContext)) {
System.out.println(response.getStatusLine());
HttpEntity entity = response.getEntity();
EntityUtils.consume(entity);
final HttpRequest request = clientContext.getRequest();
System.out.println(request.getRequestLine().getUri());
System.out.println(request.getFirstHeader("Host"));
final List<URI> redirectLocations = clientContext.getRedirectLocations();
System.out.println(redirectLocations);
}
这是错误
清单合并失败:属性application @ appComponentFactory 值=(android.support.v4.app.CoreComponentFactory)来自 [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91 也出现在[androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86 值=(androidx.core.app.CoreComponentFactory)。 建议:添加'tools:replace =“ android:appComponentFactory”'
答案 0 :(得分:-1)
问题与AndroidX库有关。将您的支持库迁移到AndroidX。 在AndroidStudio中,您可以使用 Refactor>迁移到AndroidX 菜单手动执行此操作。使用VCS(例如git)跟踪更改,以了解发生了什么。
您还可以通过将gradle依赖项更改为以下内容来手动完成此操作:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
implementation 'com.firebaseui:firebase-ui-database:0.4.1'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
然后,找到所有旧的依赖项导入以及新的依赖项导入。
gradle.properties
中可以解决一些相关问题:
android.enableJetifier=true
android.useAndroidX=true