thiszhong / react-native-easy-downloader

A downloadManager for react-native to use system downloadManager(Show download progress in notifications) and install apk files on android
13 stars 5 forks source link

按照步骤来,编译阶段的时候报错,报错信息如下: #5

Open liu-miao-miao opened 5 years ago

liu-miao-miao commented 5 years ago

Error: Attribute provider#androidx.core.content.FileProvider@authorities value=(com.mayenjoy.RNDownloadManager.fileProvider) from [:react-native-easy-downloader] AndroidManifest.xml:21:13-78 is also present at [:react-native-apk-manager] AndroidManifest.xml:17:13-60 value=(com.cyd.mianfei.xiaoshuo.provider). Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:19:9-27:20 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

liu-miao-miao commented 5 years ago

"react-native-easy-downloader": "^0.1.0",

thiszhong commented 5 years ago

看提示应该是 fileProvider 功能配置冲突了(和react-native-apk-manager),去掉一个或者按照建议

Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:19:9-27:20 to override.

试试。

一段时间没有做RN了,安卓又有新版本了,暂时没有时间精力去适配(安卓机型太难搞了),如果没有原生支持或者要求不那么高,建议用 Linking 打开浏览器去下载安装或者 react-native-fs 应用内下载,或者参考现有逻辑搜索原生代码优化进去

liu-miao-miao commented 5 years ago

谢谢,已经解决了,在你的库的AndroidManifest.xml 加了点东西

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mayenjoy.RNDownloadManager">
    package="com.mayenjoy.RNDownloadManager"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
@@ -9,10 +10,11 @@
    <application>
        <!-- Android 7.0 照片、APK下载保存路径-->
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.mayenjoy.RNDownloadManager.fileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />