crazecoder / flutter_bugly

腾讯Bugly flutter应用更新统计及异常上报插件,支持Android、iOS
Other
595 stars 163 forks source link

flutter_bugly与其他lib一起使用时FileProvider冲突 #91

Closed jucilang closed 3 years ago

jucilang commented 4 years ago

E:\work\git\shoukabao_android\android\app\src\debug\AndroidManifest.xml:13:13-64 Error: Attribute provider#androidx.core.content.FileProvider@authorities value=(com.aibao.shoukabaof.fileProvider) from [:flutter_bugly] AndroidManifest.xml:13:13-64 is also present at [:flutter_webview_plugin] AndroidManifest.xml:11:13-64 value=(com.aibao.shoukabaof.fileprovider). Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:11:9-19:20 to override. E:\work\git\shoukabao_android\android\app\src\debug\AndroidManifest.xml:18:17-55 Error: Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:flutter_bugly] AndroidManifest.xml:18:17-55 is also present at [:flutter_webview_plugin] AndroidManifest.xml:17:17-50 value=(@xml/filepaths). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml to override.

FAILURE: Build failed with an exception.

两个lib在AndroidManifest.xml都用了相同的provider配置,gradle合并时报错,在项目使用自定义FileProvider的方式还是编译报错,需要修改flutter_bugly源码内的provider配置才可以正常编译。

CocoaZX commented 4 years ago

Execution failed for task ':app:processReleaseManifest'.

Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:flutter_bugly] AndroidManifest.xml:18:17-55 is also present at [:open_file] AndroidManifest.xml:20:17-50 value=(@xml/filepaths). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml to override. 我也有这个错误

CocoaZX commented 4 years ago

怎么修改呢

jucilang commented 4 years ago

你的错误信息显示两个库有冲突的provider配置,试试修改其中一个库的源码

ZMNOTZ commented 4 years ago

我也遇到了 如果没有FileProvider 就在Manifest.xml里添加file provider ,然后添加文件 xml/path_provider.xml,把tools 添加进去 标签 <provider tools:replace="android:authorities"//添加tools android:name="androidx.core.content.FileProvider" android:authorities="com.stadyapp.rm.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data tools:replace="android:resource"//添加tools android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />

yyfd2013zy commented 4 years ago

非常感谢作者开发了这个plugin,对应这个问题我的解决方法如下 把库下载下来,改成本地依赖。自己改一下plugin 中 Android module 内的AndroidManifest.xml里面的 provider 描述,做法是新建一个java类继承于FileProvider,AndroidManifest中provider指向这个新创建的java类。 建议作者更新到pub库中