bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
574 stars 777 forks source link

Error generating android app #288

Open renanmoraes opened 4 years ago

renanmoraes commented 4 years ago

I installed the plugin and I am trying to build the application, previously the installation was working perfectly.


See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

22 actionable tasks: 1 executed, 21 up-to-date
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml:21:5-90 Error:
        Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:21:5-90 duplicated with element declared at AndroidManifest.xml:16:5-65
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml:22:5-85 Error:
        Element uses-feature#android.hardware.camera at AndroidManifest.xml:22:5-85 duplicated with element declared at AndroidManifest.xml:18:5-84
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml Error:
        Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
/home/renanrodrigues/projects/applications/rdoe/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml:21:5-90 Error:
        Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:21:5-90 duplicated with element declared at AndroidManifest.xml:16:5-65
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml:22:5-85 Error:
        Element uses-feature#android.hardware.camera at AndroidManifest.xml:22:5-85 duplicated with element declared at AndroidManifest.xml:18:5-84
/home/renanrodrigues/projects/applications/rdoe/platforms/android/app/src/main/AndroidManifest.xml Error:
        Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android --device exited with exit code 1.

Error is happening in AndroidManifest.xml file

<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" />
        <activity android:label="Share" android:name="com.google.zxing.client.android.encode.EncodeActivity" />
    </application>
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    <uses-feature android:name="android.hardware.camera" android:required="true" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-feature android:name="android.hardware.nfc" android:required="false" />
    <uses-permission android:name="android.permission.CAMERA" android:required="false" />
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.front" android:required="false" />
</manifest>

I need to solve this, how to see?

Cordova version 9.0.0 (cordova-lib@9.0.1)

Ionic version 5.4.4

QR Scanner "cordova-plugin-qrscanner": "^3.0.1"

silkroadnomad commented 4 years ago

Your AndroidManifest.xml has errors.
you added: permission.CAMERA twice!

you can see it in your own error message: Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:21:5-90 duplicated with element declared at AndroidManifest.xml:16:5-65

you can try this little howto, which helped me to find a strange error: https://medium.com/@yangnana11/cordova-plugin-qrscanner-getting-started-df747718f2e