我正在尝试将“ TedBottomPicker”库包含到我的项目中。在我在gradle中添加库并进行同步之后。然后我得到清单合并失败错误。我检查并添加了tools:replace:"android:authorities"
和tools:replace="android:resource"
,但没有用。
清单:
<?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.f.f">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:name=".AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/NoActionBar">
<activity
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/splashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Login"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/title_activity_login"
android:theme="@style/NoActionBar" />
<activity
android:name=".Register"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label=""
android:theme="@style/NoActionBar" />
<activity
android:name=".listdisplay"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/title_activity_listdisplay"
android:theme="@style/AppTheme.NoActionBar1" />
<activity
android:name=".PostActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label=""
android:theme="@style/NoActionBar"
android:windowSoftInputMode="stateVisible|adjustResize" />
<provider
android:name=".fp"
android:authorities="${applicationId}.share"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"
tools:replace="android:resource"/>
</provider>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.com.vansuita.pickimage.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/picker_provider_paths" />
</provider>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCG_a_xOn9SNyQLPBCHrdSPgu49MHbACdA" />
</application>
我在Android清单中收到的错误。
Merging Errors: Error: Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/picker_provider_paths) from AndroidManifest.xml:95:17-55 is also present at AndroidManifest.xml:21:17-55 value=(@xml/provider_paths). Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml:105:13-107:65 to override. app main manifest (this file), line 94
如何将这个库包含到我的项目中。
答案 0 :(得分:0)
执行以下操作,看看现在是否可以使用:
<application
android:name=".AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/NoActionBar"
tools:replace="android:resource">
像这样使你的收获:
android {
...
defaultConfig {
...
multiDexEnabled true
...
}
...
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}
答案 1 :(得分:0)
我认为您必须在清单中添加提供程序才能使用该 Api 示例
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="app.{idOfYourApp}.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
tools:replace="android:resource" />
</provider>