Closed tribalboy3000 closed 6 years ago
I'm experiencing the same issue.
Why are the permissions being set like this? `
`
The empty xmlns:android namespace is causing the build to fail for me.
Hello??? Is this thing on???
Same issue, does anyone solve problem?
BUILD FAILED
Total time: 1.301 secs Error: /project/gradlew: Command failed with exit code 1 Error output: [Fatal Error] :13:352: The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'project'.
Exception while parsing the supplied manifest file /project/AndroidManifest.xml
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
I have the same issue trying to use PhoneGap Build cli-7.0.1, which uses Cordova 6.2.3 for Android.
First, I tried it as stated in the plugin docs:
`
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
`
That didn't work so I tried it the way the Cordova docs specify:
`
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>`
That didn't work either. I'm adding the Android namespace to my config like this:
xmlns:android="http://schemas.android.com/apk/res/android"
But that doesn't make any difference.
I looked at past versions of my code and it used to compile without any config additions. I just used the Cordova-android-permissons plugin to ask for camera permission before calling the plugin. Now, that doesn't work because the build fails.
Any suggestions?
If I roll back to 0.7.1 on NPM it compiles properly. Not sure what changed between versions.
Edit:
However, I still get Scanning Failed: write settings: false
I will play around with the config file to see if I can get it working.
I have it working using PhoneGap Build for version 0.7.0 if anyone wants to roll back while we wait, my config contains:
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.rebrandsoftware.appname" versionCode="1" version="1.0.0">
<preference name="phonegap-version" value="cli-7.0.1" /> <preference name='pgb-builder-version' value='2' />
<plugin name="cordova-plugin-barcodescanner" spec="0.7.0" source="npm" /> <plugin name="cordova-plugin-android-permissions" spec="1.0.0" source="npm" />
<platform name="android"> <config-file target="AndroidManifest.xml" parent="/*" mode="merge"> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> </config-file> </platform> `
And to check permissions just in case I'm doing this:
var scan = function() {
cordova.plugins.barcodeScanner.scan(
function(result) {
// alert("We got a barcode\n" +
// "Result: " + result.text + "\n" +
// "Format: " + result.format + "\n" +
// "Cancelled: " + result.cancelled);
},
function(error) {
alert("Scanning failed: " + error);
}
);
};
if (Device.platform === "Android") { var permissions = cordova.plugins.permissions; permissions.hasPermission(permissions.CAMERA, checkPermissionCallback, null);
function checkPermissionCallback(status) {
if (!status.hasPermission) {
var errorCallback = function() {
console.warn('Camera permission is not turned on');
};
permissions.requestPermission(
permissions.CAMERA,
function(status) {
if (!status.hasPermission) {
errorCallback();
} else {
scan();
}
},
errorCallback);
} else {
scan();
}
}
} else { scan(); }
try again with 0.7.3
Hi,
thank you for the update, but is still not working. The xml error is already displayed at build the app.
[Fatal Error] :12:139: Wert des Attributs "prefix="xmlns",localpart="android",rawname="xmlns:android"" ist ungültig. Namespace Bindings mit Präfix dürfen nicht leer sein.
Thank you.
Hello Pompingo,
this worked for me:
cordova plugin remove cordova-plugin-barcodescanner cordova plugin add cordova-plugin-barcodescanner@0.7.1
Add the 'xmlns:android="http://schemas.android.com/apk/res/android"' in config.xml:
<config-file mode="merge" parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" xmlns:android="http://schemas.android.com/apk/res/android" />
<uses-feature android:name="android.hardware.camera" xmlns:android="http://schemas.android.com/apk/res/android" />
<uses-feature android:name="android.hardware.camera.autofocus" xmlns:android="http://schemas.android.com/apk/res/android" />
</config-file>
Maybe this helps ;-)
peterhecker65,
Followed the suggestion, but now get the following error:
:processDebugManifestC:\workspaces\ion-scanner\platforms\android\AndroidManifest.xml:36:5-85 Error: Element uses-feature#android.hardware.camera at AndroidManifest.xml:36:5-85 duplicated with element declared at AndroidManifest.xml:33:5-60
I tried editing AndroidManifest but that is ineffective since it is overwritten.
So I am wondering if some version of something is not correct.
What versions are are others using to get this to build? This is what I have
Installed platforms: android 6.2.3 browser 5.0.0 ios 4.5.1
Here are the plugins - I don't think any of these should be adding the duplicate.
cordova plugin list cordova-plugin-barcodescanner 0.7.1 "BarcodeScanner" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-device 1.1.4 "Device" cordova-plugin-splashscreen 4.0.3 "Splashscreen" cordova-plugin-statusbar 2.2.4-dev "StatusBar" cordova-plugin-whitelist 1.3.2 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard"
Thanks.
@hypery2k after installing 0.7.3 I have the same error as before:
[Fatal Error] :35:139: The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.
Tried ionic remove/add plugin
, ionic remove/add android
. Nothing helps(
Any ideas how to fix it?
@cscumming-dwss I found reference to this problem: https://issues.apache.org/jira/browse/CB-12255?jql=text%20~%20%22android%20manifest%20duplicates%22
As a workaround for now - fork cordova-barcodescanner-plugin
and remove permissions requirement. It's described here: https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/418#issuecomment-338076932
Steps to fix this problem which worked for me:
config.xml
add xmlns:android="http://schemas.android.com/apk/res/android"
to widget
cordova plugin remove cordova-plugin-barcodescanner
cordova plugin add cordova-plugin-barcodescanner@0.7.0
plugins/cordova-plugin-barcodescanner/plugin.xml
comment or remove line
<uses-feature android:name="android.hardware.camera" android:required="false"/>
cordova platform remove android
cordova platform add android
Hello, Fixed it by adding android namespace in config file
`
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>`
Trick by @kirillplatonov worked perfectly for me...thanks mate!
This is how I've solved it.
Open plugins/cordova-plugin-barcode-scanner/plugin.xml and delete all records xmlns:android=""
Open platforms/android/android.json and delete all xmlns:android=\"\"
Do the same in platforms/android/AndroidManifest.xml
xmlns:android can't be empty like error tells us:
The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.
Why this bug remains until today? This is sad. Thanks @kirillplatonov
a little nicer comment would be great. Fixed in 0.7.4
Keep in mind: Free Open Source software does not mean free in terms of free beer.
BTW: Will discontinue this plugin
Sorry, I did not mean to offend you. You did a great job, I thank you so much for that. But sometimes it seems that repositories are forgotten and this is sad for the whole community.
Again, sorry if I was rude or maybe google translator misunderstood me.
sure, but keep in mind most people do this in their spare time. So maybe they got other stuff to do.
Here is my process:
install: cordova plugin add cordova-plugin-barcodescanner
add to config.xml:
run: cordova build android
Error: Error: /Applications/MAMP/htdocs/hhFramework/app/platforms/android/gradlew: Command failed with exit code 1 Error output: [Fatal Error] :12:352: The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'android'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.