Telerik-Verified-Plugins / ImagePicker

Cordova Plugin For Multiple Image Selection
MIT License
181 stars 330 forks source link

"com.synconset.imagepicker" incorrectly adding to package.json dependencies #71

Closed findel closed 6 years ago

findel commented 7 years ago

When using this plugin with Ionic (as per http://ionicframework.com/docs/native/image-picker/) it's breaking.

After running ionic cordova plugin add cordova-plugin-telerik-imagepicker and npm install --save @ionic-native/image-picker everything seems fine.

But when you then go to use ionic cordova run or ionic cordova build a reference to "com.synconset.imagepicker" is inserted into the package.json dependencies list. This is not a valid node module name, so it fails the next time npm install is run.

djabif commented 7 years ago

any update on this?

QaseemLodhi commented 7 years ago

How can solve this issue? Any idea?

abinasp commented 7 years ago

I found a workaround by removing the single line "com.synconset.imagepicker": "~2.1.8" from package.json. And "com.synconset.imagepicker": { "PHOTO_LIBRARY_USAGE_DESCRIPTION": "Add multiple photos" } shows warning while execute the commands like: cordova platform add android and cordova run android. It worked for me. But we need to inform this to ionic team, i believe it's a bug.

Bleno commented 7 years ago

@2010abinas It's solved for me

qw1210p commented 7 years ago

@Bleno ,can you share the soluation of this problem?

Bleno commented 7 years ago

@qw1210p Was the same workaround commented by @2010abinas .

removing the single line "com.synconset.imagepicker": "~2.1.8" from package.json.

It worked for me, but I think not be the best solution.

Kevin-Chinem commented 7 years ago

When i run ionic package build android got this error:

Discovered plugin "com.synconset.imagepicker" in config.xml. Adding it to the project Fetching plugin "com.synconset.imagepicker@~2.1.8" via npm Failed to restore plugin "com.synconset.imagepicker" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin com.synconset.imagepicker@~2.1.8 via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: Registry returned 404 for GET on https://registry.npmjs.org/com.synconset.imagepicker

These problems are related? imagepicker plugin doesn't install on ionic cloud build.

fission1110 commented 7 years ago

Every time ionic does an android build it parses the config.xml and adds all the plugins that it finds to the packages.json dependency list.

Discovered plugin "com.synconset.imagepicker" in config.xml. Adding it to the project

In this case, that's the wrong behavior because com.synconset.imagepicker is not a npm plugin.

Then when you do an npm update it fails because this isn't a valid plugin.

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/com.synconset.imagepicker npm ERR! 404 npm ERR! 404 'com.synconset.imagepicker' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

The work around is to remove com.sysconset.imagepicker from the package.json every time you do a build and try to not check it in to your VCS system. Annoying.

This doesn't seem like a "bug" on the ionic side, but rather a poorly thought out feature to keep the config.xml and packages.json in sync.

This is also currently a massive gaping security vulnerability because anyone can, right now, register the com.synconset.imagepicker name on the npm registry and put whatever code they want on there.

Ottunger commented 7 years ago

Hmmm not working for me. Any command such as:

    ionic cordova emulate android
    ionic cordova build android --prod

Will fail because of trying to inject it:

    Discovered plugin "com.synconset.imagepicker" in config.xml. Adding it to the project
    Failed to restore plugin "com.synconset.imagepicker" from config.xml. You might need to try adding it again.
    Error: Failed to fetch plugin com.synconset.imagepicker@~2.1.8 via registry.
    Probably this is either a connection problem, or plugin spec is incorrect.
    Check your connection and plugin name/version/URL.
    Error: cmd: Command failed with exit code 1 Error output:
    npm ERR! code E404
    npm ERR! 404 Not Found: com.synconset.imagepicker@~2.1.8

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Gregoire\AppData\Roaming\npm-cache\_logs\2017-09-16T11_02_50_304Z-debug.log

If this is really needed, please make sure the package name is OK, or remove the dep.

djabif commented 7 years ago

@EddyVerbruggen please any help with this? Thanks

EddyVerbruggen commented 7 years ago

@djabif I'd be happy to use a PR but I don't have the time to do much more atm.

abinasp commented 7 years ago

in Ionic2 if you are using any existing project and you do npm install, after that time just remove the com.synconset.imagepicker plugin from package.json and config.json as well. Because the com.synconset.imagepicker is not present in npm directory that's why we get error. After doing all the set up then install com.synconset.imagepicker plugin, it will work perfect.

aelshemy16 commented 6 years ago

Same issue faced after removing android platform try to re add it again and found this error

`Installing "com.synconset.imagepicker" for android

Error during processing of action! Attempting to revert...

Failed to install 'com.synconset.imagepicker': Error: Uh oh! ENOENT: no such file or directory, open '/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/AndroidManifest.xml' at Error (native) at Object.fs.openSync (fs.js:642:18) at Object.fs.readFileSync (fs.js:510:33) at Object.parseElementtreeSync (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27) at new AndroidManifest (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/lib/AndroidManifest.js:29:20) at AndroidProject.getPackageName (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/lib/AndroidProject.js:99:12) at AndroidProject.getCustomSubprojectRelativeDir (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/lib/AndroidProject.js:105:28) at install (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/lib/pluginHandlers.js:106:46) at Object.process (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25) at PluginManager.doOperation (/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)

(node:89774) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Uh oh! ENOENT: no such file or directory, open '/Applications/XAMPP/xamppfiles/htdocs/stadna/stadna-mobile/platforms/android/AndroidManifest.xml'

ionic cordova resources android --force ✔ Collecting resource configuration and source images - done! ✔ Filtering out image resources that do not need regeneration - done! ✔ Uploading source images to prepare for transformations - done! ✔ Generating platform resources: 18 / 18 complete - done! ✔ Modifying config.xml to add new image resources - done!`

if any help ?!

fedemoreno commented 6 years ago

Hi There!! I have the same issue :\ Does someone solve it?

Android project created with cordova-android@7.0.0 Android Studio project detected

Android Studio project detected

Installing "com.synconset.imagepicker" for android

Error during processing of action! Attempting to revert...

Failed to install 'com.synconset.imagepicker': Error: Uh oh! ENOENT: no such file or directory, open '/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/AndroidManifest.xml' at Object.fs.openSync (fs.js:646:18) at Object.fs.readFileSync (fs.js:551:33) at Object.parseElementtreeSync (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27) at new AndroidManifest (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/lib/AndroidManifest.js:29:20) at AndroidProject.getPackageName (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/lib/AndroidProject.js:99:12) at AndroidProject.getCustomSubprojectRelativeDir (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/lib/AndroidProject.js:105:28) at install (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/lib/pluginHandlers.js:106:46) at ActionStack.process (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25) at PluginManager.doOperation (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20) at PluginManager.addPlugin (/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)

(node:24970) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Uh oh! ENOENT: no such file or directory, open '/Users/Federico/Documents/FG-V2.2.7/FG-V2.2.7-FG/platforms/android/AndroidManifest.xml' (node:24970) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

benpoucareformance commented 6 years ago

Same issue with commands : $ cordova platform remove android $ cordova platform add android

Seems to be a folders and files organization issue, Cordova is searching in /platforms/android/AndroidManifest.xml, but the is there /platforms/android/app/src/main/AndroidManifest.xml

I tried to update the paths everywhere I found it with no success.

Is there a link with angular/schematics ? Using yarn here and at $ yarn install, I've got some warnings on schematics dependencies...

azeemse commented 6 years ago

@fedemoreno & @benpoucareformance Is there any fix for these issues???

benpoucareformance commented 6 years ago

@azeemse Yes, the only way I found is just about android package version, you need to downgrade at android 6.3.0.

Here are my notes on this subject (you don't need to do it for ios if you don't have any problem):

Check versions (see /config.xml or command "$ ionic info"):

Steps:

$ ionic cordova platform rm android
$ ionic cordova platform rm ios

Run prepare command:

$ ionic cordova prepare

Reinstall platforms:

$ ionic cordova platform add android@6.3.0
$ ionic cordova platform add ios@4.5.2

-- config.xml

<plugin name="com.synconset.imagepicker" spec="~2.1.8">
        <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="Allows users to select a profile picture for their profile." />
</plugin>

-- package.json

"com.synconset.imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "Allows users to select a profile picture for their profile."
}

It's a big waste of time, for sure.

azeemse commented 6 years ago

@benpoucareformance Thanks for sharing this. I was thinking of not downgrading the android version but it seems no other fix available right now. Even the Cordova-Android version 7.1.0 has also been launched but it still contains the same issue.

benpoucareformance commented 6 years ago

@azeemse Yes it is, I tried to updated all paths in plugin script, but there was others issues in packages hooks. Better would too have another image picker plugin... Don't know if it exists...

azeemse commented 6 years ago

@benpoucareformance I have tried searching any other image picker plugin but couldn't get any thing latest. I am finally able to run my app on my Android device. :)

benpoucareformance commented 6 years ago

Thanks for sharing this. I was thinking of not downgrading the android version but it seems no other fix available right now. Even the Cordova-Android version 7.1.0 has also been launched but it still contains the same issue.

Actually, it's not a Cordova version issue but a telerik image picker plugin issue I guess, they aren't update it to the new folder tree of Cordova Android version

azeemse commented 6 years ago

Actually, it's not a Cordova version issue but a telerik image picker plugin issue I guess, they aren't update it to the new folder tree of Cordova Android version

If so then at least Ionic should update their documentation with some verified image picker. They are still using the Telerik image picker in their docs.

https://ionicframework.com/docs/native/image-picker/

tperrelli commented 6 years ago

Hi, i'm having the same issue too.

  1. I've removed android "ionic cordova platform remove android"
  2. I've removed the reference from the config.xml file
  3. I've removed the reference from the package.json file
  4. Finally i've added the android plataform back

But everytime i try to build or run in device the ionic tries to install the annoying com.synconset.imagepicker package back again. 👎

Does anyone have got the solution?

tperrelli commented 6 years ago

Well, i've just noticed that if we want to completely remove the com.synconset.imagepicker from our projetct, we also need to remove it reference from plugins/fetch.json file. This way, cordova does not try to install it back in every build.

romain10009 commented 6 years ago

Hi guys, follow the infos here, no need to downgrade cordova. It works on 7.1.0 Cordova hook for Manifest.xml

Sjerd commented 6 years ago

These issues are fixed in pr 114

EddyVerbruggen commented 6 years ago

@Sjerd thanks! Part of 2.2.0 (now on npm).

Nikhath7829 commented 4 years ago

Hi ,
I'm using ionic5 Have tried out with android 6.3.0 and android 7.1.0, The same error triggers .Please anyone can show me light towards this will be very helpfull

Ionic Framework : @ionic/angular 5.3.3 @angular-devkit/build-angular : 0.1000.8 @angular-devkit/schematics : 10.0.8 @angular/cli : 10.0.8 @ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (1 plugins total)

cordova.cmd plugin ls cordova-plugin-telerik-imagepicker 2.3.5 "ImagePicker"