jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

Issue in android manifest file #26

Closed ahaneef29 closed 6 years ago

ahaneef29 commented 6 years ago

13:37:24 - Compilation complete. Watching for file changes.

     + setting applicationId
     + applying user-defined configuration from C:\projects\Real_App\app\App_Resources\Android\app.gradle
     + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
     + adding aar plugin dependency: C:\projects\Real_App\node_modules\nativescript-camera\platforms\android\nativescript_camera.aar
     + adding aar plugin dependency: C:\projects\Real_App\node_modules\nativescript-mediafilepicker\platforms\android\MultiTypeFilePicker-release.aar
     + adding aar plugin dependency: C:\projects\Real_App\node_modules\nativescript-mediafilepicker\platforms\android\nativescript_mediafilepicker.aar
     + adding aar plugin dependency: C:\projects\Real_App\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar

C:\projects\Real_App\platforms\android\app\src\main\AndroidManifest.xml:19:17-55 Error: Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:nativescript_camera:] AndroidManifest.xml:19:17-55 is also present at [:MultiTypeFilePicker-release:] AndroidManifest.xml:46:17-51 value=(@xml/file_paths). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml to override.

FAILURE: Build failed with an exception.

jibon57 commented 6 years ago

Solution is there too:

Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml to override.

After that clean platform directory & try again. it should work.

 Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:nativescript_camera:] AndroidManifest.xml:19:17-55
is also present at [:MultiTypeFilePicker-release:] AndroidManifest.xml:46:17-51 value=(@xml/file_paths).

If possible try to use either nativescript-camera plugin or this plugin.

ahaneef29 commented 6 years ago

where i should place this exactly in manifest . 'tools:replace="android:resource"' ?

nginx17 commented 6 years ago

Please reopen this issue , cause not fixed the problem

jibon57 commented 6 years ago

@haneef5k Please follow this one: https://stackoverflow.com/a/45025597/8875176

Or remove nativescript-camera because this plugin is conflict here.

@nginx17 this problem isn't related with this plugin.

jibon57 commented 6 years ago

@haneef5k if you are following https://stackoverflow.com/a/45025597/8875176 then you may need to change

details.useVersion '25.3.0' to details.useVersion '27.0.1'

jibon57 commented 6 years ago

The problem is happening because this plugin & nativescript-camera both are using FileProvider. So, during build it having problem to merge. I still recommend you to uninstall nativescript-camera plugin before trying this one.

https://github.com/NativeScript/nativescript-camera/blob/3bd512e5d6e726884912cf889d6c64473c762d1a/src/platforms/android/AndroidManifest.xml#L5

https://github.com/fishwjy/MultiType-FilePicker/blob/fbbcdbde53c0c8795c754e90c6c5f6c620976e43/filepicker/src/main/AndroidManifest.xml#L32

But @haneef5k you can look around. I just tried in a fresh project & build is working fine.

nginx17 commented 6 years ago

@jibon57 , @haneef5k

Add

<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.*.*.fileprovider" 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>

under <application *** > Fix my problem

nginx17 commented 6 years ago

don't forget add

xmlns:tools="http://schemas.android.com/tools"

at <manifest

jibon57 commented 6 years ago

@nginx17, thank you! I am closing this issue.

ahaneef29 commented 6 years ago

Thank you @nginx17 and @jibon57

nginx17 commented 6 years ago

@all

If you use the solution above, it only removes errors during run / build. but when using nativescript-camera you will find new problems and I haven't found a solution to use these 2 plugins at once.

hariaravind10 commented 5 years ago

  1. add this in manifest.xml

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

  1. add 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>
    </application>
    </manifest>

it worked for me

asciidiego commented 3 years ago

FYI See: https://github.com/jibon57/nativescript-mediafilepicker/issues/33

csimpi commented 2 years ago

These are not working for me Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from AndroidManifest.xml:54:11-45 is also present at [:nativescript_mediafilepicker:] AndroidManifest.xml:46:17-51 value=(@xml/file_paths). Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

AndroidManifest

        <activity
            android:name="com.tns.NativeScriptActivity"
            android:label="@string/title_activity_kimera"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
      android:launchMode="singleTask"
      android:hardwareAccelerated="true"
      android:windowSoftInputMode="stateHidden|adjustResize"
            android:theme="@style/LaunchScreenTheme">

            <meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
      <provider android:authorities="com.facebook.app.FacebookContentProviderXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                android:name="com.facebook.FacebookContentProvider"
                android:exported="true"
                tools:replace="android:authorities"/>

      <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>