Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Android Gradle compilation with nativescript-social-share or nativescript-camera #33

Open
victorevox opened this issue Sep 20, 2018 · 6 comments

Comments

@victorevox
Copy link

Describe the bug
Android Gradle fails compilation when using this plugin with "nativescript-social-share"

To Reproduce
Just add the plugin
tns plugin add nativescript-social-share on a project with nativescript-mediafilepicker

Expected behavior
Both plugins should co-exists on same project

NativeScript Info(please run tns info):

Sample Code(please provide minimum code to reproduce problem):
https://github.com/victorevox/nativescript-test/tree/mediafilepicker-socialshare-error

Additional context
Error: Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) from [:MultiTypeFilePicker-release:] AndroidManifest.xml:46:17-51 is also present at [:nativescript_social_share:] AndroidManifest.xml:17:17-55 value=(@xml/provider_paths). Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

@jibon57
Copy link
Owner

jibon57 commented Sep 21, 2018

Common problem & explained here already: #26

You will need to add provider in your AndroidManifest.xml inside <application></application> to override like this:

<provider
	android:name="android.support.v4.content.FileProvider"
	android:authorities="${applicationId}.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>

also xmlns:tools="http://schemas.android.com/tools" in <manifest. So, it will look like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="__PACKAGE__"
	android:versionCode="1"
	android:versionName="1.0"
	xmlns:tools="http://schemas.android.com/tools">

My suggestion will be to remove those from the plugins & implement it to your app directly.

Ref:
https://stackoverflow.com/a/48270294/1281864
https://stackoverflow.com/a/27360988/1281864
https://stackoverflow.com/a/50794484/1281864

@victorevox
Copy link
Author

Awesome!, it works , thanks!

@jibon57
Copy link
Owner

jibon57 commented Sep 21, 2018

Welcome :) .. I am keeping this issue open so that other may find it quickly.

@jibon57 jibon57 reopened this Sep 21, 2018
@jibon57 jibon57 changed the title Android Gradle compilation with nativescript-social-share Android Gradle compilation with nativescript-social-share or nativescript-camera Sep 21, 2018
@asciidiego
Copy link

@jibon57 can you explain what "remove those from the plugin and implement in the app directly" mean?

What do you recommend removing and what do you exactly recommend implementing?

@asciidiego
Copy link

BTW, people who currently have this same issue (we had it using {N} v7 on Android with the social share plugin), we fixed it using these lines instead:

<provider
        <!-- notice the `androidx.core` instead of `android.support.v4` -->
        <!-- See: https://github.com/jibon57/nativescript-mediafilepicker/blob/4a3c38ecb06e0483ec49001727bc790e71c0ebf5/src/platforms/android/AndroidManifest.xml#L34 -->
	android:name="androidx.core.content.FileProvider"
	android:authorities="${applicationId}.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>

@csimpi
Copy link

csimpi commented Feb 12, 2022

@jibon57 these are not working for me at all, getting the same error, even I add exactly what the error message suggest, tried all of the solution from this tread also the similar threads, same error. After running clean, the same. Deleting the platforms folder, the same

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants