简体   繁体   English

使用react-native-camera创建非常简单的应用程序时出错

[英]Error on creating very very simple app using react-native-camera

I recently wanted to create a react-native app with camera and started working with react-native-camera so I just did this: 我最近想用相机创建一个react-native应用程序,并开始使用react-native-camera所以我做到了:

$ react-native init testApp2
$ npm install --save react-native-camera
$ react-native link react-native-camera
$ react-native run-android

After the last line I'm getting weird outputs (below)(I have Android studio installed on my pc and exact errors are created by the Android studio when I go for building apk) 在最后一行之后,我得到奇怪的输出(如下)(我在PC上安装了Android Studio,并且当我去构建APK时,由Android Studio创建了确切的错误)

Scanning folders for symlinks in C:\Users\seyye_000\Documents\testApp2\node_modules (31ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
:app:preBuild UP-TO-DATE
:react-native-camera:preBuild UP-TO-DATE
:react-native-camera:preDebugBuild UP-TO-DATE
:react-native-camera:checkDebugManifest UP-TO-DATE
:react-native-camera:processDebugManifest UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:react-native-camera:compileDebugAidl UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:react-native-camera:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:react-native-camera:mergeDebugShaders UP-TO-DATE
:react-native-camera:compileDebugShaders UP-TO-DATE
:react-native-camera:generateDebugAssets UP-TO-DATE
:react-native-camera:packageDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:react-native-camera:compileDebugRenderscript UP-TO-DATE
:react-native-camera:generateDebugResValues UP-TO-DATE
:react-native-camera:generateDebugResources UP-TO-DATE
:react-native-camera:packageDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:mainApkListPersistenceDebug UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:react-native-camera:platformAttrExtractor UP-TO-DATE
:react-native-camera:generateDebugRFile UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:react-native-camera:generateDebugBuildConfig UP-TO-DATE
:react-native-camera:prepareLintJar UP-TO-DATE
:react-native-camera:generateDebugSources UP-TO-DATE
:react-native-camera:javaPreCompileDebug UP-TO-DATE
:react-native-camera:compileDebugJavaWithJavac UP-TO-DATE
:react-native-camera:processDebugJavaRes NO-SOURCE
:react-native-camera:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebugD8: Program type already present: com.facebook.infer.annotation.FalseOnNull

FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task 
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\54.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\56.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\57.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\58.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\60.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\61.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\62.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\63.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\76.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\77.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\78.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\79.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\80.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\84.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\98.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\99.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\100.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\101.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\102.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\103.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\104.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\105.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\106.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\107.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\108.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\109.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\110.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\111.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\112.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\113.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\114.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\115.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\116.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\117.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\118.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\119.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\120.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\121.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\122.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\123.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\124.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\125.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\126.jar, C:\Users\seyye_000\Documents\testApp2\android\app\build\intermediates\transforms\dexBuilder\debug\127.jar

* 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 21s
36 actionable tasks: 1 executed, 35 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

I've tried every possible way to play with Android studio to get this error fixed but I'm really tired and don't know what to do next. 我尝试了各种可能的方式与Android Studio一起使用,以解决此错误,但我真的很累,不知道下一步该怎么做。 :\\ :\\

Here is my package.json : 这是我的package.json

{
  "name": "testApp2",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-camera": "^1.1.3"
  },
  "devDependencies": {
    "babel-jest": "22.4.4",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.4",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

if you know what's wrong with this pleaase tell me, I'm starting to go really crazy... 如果您知道此事告诉我怎么了,我就会开始发疯了...

Because I don't know how to put all my code here I just uploaded it on GitHub, HERE is the link to it. 因为我不知道如何将所有代码放在这里,所以我只是将其上传到了GitHub,因此这里是其链接。

Try enabling multiDex 尝试启用multiDex

In app/build.gradle: app / build.gradle中:

android {
    defaultConfig {
       multiDexEnabled true
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM