ishaquehassan / document_scanner_flutter

A document scanner plugin for flutter
MIT License
59 stars 131 forks source link

INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed #19

Open rishabhj126 opened 2 years ago

rishabhj126 commented 2 years ago

Trying to install same dependency in two apps gives

Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.ysh.sdb--5GF3pMkE5_bKqOwmq56_g==: Can't install because provider name com.scanlibrary.provider (in package com.ysh.sdb) is already used by com.ysh.xzsd] Error launching application on LON AL00.

rajada1 commented 2 years ago

add this in /android/app/src/main/AndroidManifest

<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.flutter_inappwebview.fileprovider" tools:replace="android:authorities" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> </provider>

samoray1998 commented 2 years ago

hey @rishabhj126 ,i think your phone already have an app that uses the same package try to uninstall it and and run your new app . i hope this will solve your problem

rajada1 commented 2 years ago

hey @rishabhj126, acho que seu telefone já tem um aplicativo que usa o mesmo pacote tente desinstalá-lo e executar seu novo aplicativo . espero que isso resolva o seu problema

This is not a viable solution.

rishabhj126 commented 2 years ago

hey @rishabhj126 ,i think your phone already have an app that uses the same package try to uninstall it and and run your new app .

i hope this will solve your problem

But both app requires to have same feature then what to do?

samoray1998 commented 2 years ago

i know that it's not a great solution but it may save a lot of people time, i had the same issue and i solve it this way ,so,just try at the first beginning to remove the old app and test the new one and see if it works for you.

sanjeevinnobit commented 1 year ago

@rishabhj126 you are facing this issue because the package owner has not handled the FIleProvider properly.

I have made some changes and fixed this issue

Please follow the below steps, it will resolve your problem:

Step 1: In your pubspec.yaml file (remove document scanner and add this)

document_scanner_flutter:
  git:
    url: https://github.com/sanjeevinnobit/document_scanner_flutter.git
    ref: master

Step 2: add this in /android/app/src/main/AndroidManifest

<provider
    android:name="androidx.core.content.FileProvider" 
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>

Step 3: in your /android/app/build.gradle

minSdkVersion 21