HarvestProfit / react-native-rectangle-scanner

React Native Document/Rectangle Scanner
MIT License
199 stars 62 forks source link

Cant make the package work in fresh react-native project #7

Closed onur-ozkan closed 4 years ago

onur-ozkan commented 4 years ago

This is the output when I run 'react-native run-android'

> Task :app:processDebugManifest FAILED

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
113 actionable tasks: 99 executed, 14 up-to-date
Note: /Users/nimda/Devspace/Awesome/node_modules/@react-native-community/image-editor/android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-camera/android/src/main/java/com/google/android/cameraview/Camera2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/nimda/Devspace/Awesome/android/app/src/debug/AndroidManifest.xml:14:7-34 Error:
    Attribute application@allowBackup value=(false) from AndroidManifest.xml:14:7-34
    is also present at [us.feras.mdv:markdownview:1.1.0] AndroidManifest.xml:12:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:14:7-34
    is also present at [us.feras.mdv:markdownview:1.1.0] AndroidManifest.xml:12:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* 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 6s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /Users/nimda/Devspace/Awesome/node_modules/@react-native-community/image-editor/android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-camera/android/src/main/java/com/google/android/cameraview/Camera2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nimda/Devspace/Awesome/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/nimda/Devspace/Awesome/android/app/src/debug/AndroidManifest.xml:14:7-34 Error:
    Attribute application@allowBackup value=(false) from AndroidManifest.xml:14:7-34
    is also present at [us.feras.mdv:markdownview:1.1.0] AndroidManifest.xml:12:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:14:7-34
    is also present at [us.feras.mdv:markdownview:1.1.0] AndroidManifest.xml:12:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* 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 6s

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (/Users/nimda/Devspace/Awesome/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/Users/nimda/Devspace/Awesome/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at /Users/nimda/Devspace/Awesome/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/Users/nimda/Devspace/Awesome/node_modules/@react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
jirka-oone commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

onur-ozkan commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

jirka-oone commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

still the same error ? could you paste your AndroidManifest ?

onur-ozkan commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

still the same error ? could you paste your AndroidManifest ?

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.teeest">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
  android:allowBackup="false"
  tools:replace="android:allowBackup"
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

I create a new project by react-native cli and getting that error. So I dont add anything extra than what the rn-rectangle-scanner documentation says.

jirka-oone commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

still the same error ? could you paste your AndroidManifest ?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
  android:allowBackup="false"
  tools:replace="android:allowBackup"
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

I create a new project by react-native cli and getting that error. So I dont add anything extra than what the rn-rectangle-scanner documentation says.

I see, i changed /src/debug/AndroidManifest.xml, in case of /src/main/AndroidManifest.xml you have to put xmlns:tools="http://schemas.android.com/tools" to the element

like this: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.modalcamera" xmlns:tools="http://schemas.android.com/tools">

onur-ozkan commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

still the same error ? could you paste your AndroidManifest ?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
  android:allowBackup="false"
  tools:replace="android:allowBackup"
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

I create a new project by react-native cli and getting that error. So I dont add anything extra than what the rn-rectangle-scanner documentation says.

I see, i changed /src/debug/AndroidManifest.xml, in case of /src/main/AndroidManifest.xml you have to put xmlns:tools="http://schemas.android.com/tools" to the element

like this: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.modalcamera" xmlns:tools="http://schemas.android.com/tools">

Its already in the file. Did you try to use the package on clean project ? We have like 10 people and all gets the same error.

jirka-oone commented 4 years ago

simple fix, add something like <application ... android:allowBackup="false" tools:replace="android:allowBackup"> in AndroidManifest.xml

Doesnt fix.

still the same error ? could you paste your AndroidManifest ?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
  android:allowBackup="false"
  tools:replace="android:allowBackup"
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

I create a new project by react-native cli and getting that error. So I dont add anything extra than what the rn-rectangle-scanner documentation says.

I see, i changed /src/debug/AndroidManifest.xml, in case of /src/main/AndroidManifest.xml you have to put xmlns:tools="http://schemas.android.com/tools" to the element like this: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.modalcamera" xmlns:tools="http://schemas.android.com/tools">

Its already in the file. Did you try to use the package on clean project ? We have like 10 people and all gets the same error.

sure, i use it without problems my steps: react-native init camera (react-native": "0.61.5, react": "16.9.0) yarn add react-native-rectangle-scanner yarn add react-native-svg in settings.gradle: include ':openCVLibrary310' ... build -> crash as you mentioned (:app:processDebugManifest allowBackup...) i changed debug AndroidManifest.xml for sure i invalidated caches & restart android studio build and the result is camera overlay on the screen

humphreyja commented 4 years ago

This issue brings up a good point. Looks like there potentially are extra dependencies in the build.gradle file. We should be able to remove them, which may be prevent the need to add those changes to your manifest file.

As a workaround the changes to AndroidManifest.xml are the same changes I have in our production app, so that should be enough to get them to work. Make sure to invalidate the cache though.

humphreyja commented 4 years ago

This is fixed in the latest version (1.0.7). You shouldn't need to change your AndroidManifest.xml file anymore.