Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while doing "cordova platform add android" #130

Open
Doomkyn opened this issue Jan 29, 2018 · 4 comments
Open

Error while doing "cordova platform add android" #130

Doomkyn opened this issue Jan 29, 2018 · 4 comments

Comments

@Doomkyn
Copy link

Doomkyn commented Jan 29, 2018

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 [email protected]
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
Copy link

Late reply but since [email protected] or [email protected] 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
Copy link

alyak46141414 commented Apr 4, 2018

solution is downgrade cordova to 6.x

@fdambrosio
Copy link

I have the same problem

@feliperfmarques
Copy link

Pull request #137 solving this problem.

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

No branches or pull requests

5 participants