tjwoon / csZBar

Cordova plugin to integrate with the ZBar barcode scanning library.
Other
143 stars 181 forks source link

Error while doing "cordova platform add android" #130

Open Doomkyn opened 6 years ago

Doomkyn commented 6 years ago

Hi, I'm trying this plugin and while the iOS platform gets compiled correctly, when I try to add the android platform, I get this error:

PS C:\Users\Kevin\Desktop\BarcodeTest> cordova platform add android
Using cordova-fetch for cordova-android@~7.0.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: it.nowhere.barcodetest
        Name: BarcodeTest
        Activity: MainActivity
        Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.0.0
Android Studio project detected
Android Studio project detected
Installing "cordova-plugin-cszbar" for android
Subproject Path: CordovaLib
Subproject Path: app
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
Failed to install 'cordova-plugin-whitelist': Error: ENOENT: no such file or directory, open 'C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\AndroidManifest.xml'
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:491:33)
    at Object.parseElementtreeSync (C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\cordova\node_modules\cordova-common\src\util\xml-helpers.js:180:27)
    at new AndroidManifest (C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\cordova\lib\AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\cordova\lib\AndroidProject.js:99:12)
    at Api.addPlugin (C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\cordova\Api.js:223:57)
    at handleInstall (C:\Users\Kevin\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:594:10)
    at C:\Users\Kevin\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:357:28
    at _fulfilled (C:\Users\Kevin\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Kevin\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Error: ENOENT: no such file or directory, open 'C:\Users\Kevin\Desktop\BarcodeTest\platforms\android\AndroidManifest.xml'
--save flag or autosave detected
Saving android@~7.0.0 into config.xml file ...

Even if this seems a problem not releated to the plugin, in the end it is, cause if I try every other plugin the platform is added without errors. Anyone managed to solve this? Thanks.

KevinJDurant commented 6 years ago

Late reply but since cordova-android@7.0.0 or cordova-android@7.1.0 the AndroidManifest.xml has moved to a new location which results in a failed install. Downgrading to version 6.4.0 fixes this issue.

Sources:

This could possibly be fixed by changing line 26 and 32 in plugin.xml and maybe the library location (line 48-59) needs to be changed.

alyak46141414 commented 6 years ago

solution is downgrade cordova to 6.x

fdambrosio commented 6 years ago

I have the same problem

feliperfmarques commented 5 years ago

Pull request #137 solving this problem.