集成react-native-camera编遇到的坑

2018-10-15  本文已影响0人  一只特例独行de猪

该模块在打包编译的时候报错,可能跟墙有关,也有跟版本有关
node_module/react-native-camera中build.gradle 替换成这个,
修改为国内maven镜像库和版本号compile "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '11.0.4')}",仅供参考

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
  repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
  }

  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
  }
}

apply plugin: 'com.android.library'

android {
  compileSdkVersion safeExtGet('compileSdkVersion', 26)
  buildToolsVersion safeExtGet('buildToolsVersion', '26.0.2')

  defaultConfig {
    minSdkVersion safeExtGet('minSdkVersion', 16)
    targetSdkVersion safeExtGet('targetSdkVersion', 26)
  }
  lintOptions {
    abortOnError false
    warning 'InvalidPackage'
  }
}

repositories {
  maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
  maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
  maven {
    // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
    url "$rootDir/../node_modules/react-native/android"
  }
}

dependencies {
  compile 'com.facebook.react:react-native:+'
  compile "com.google.zxing:core:3.3.0"
  compile "com.drewnoakes:metadata-extractor:2.9.1"
  compile "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '11.0.4')}"
  compile "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}"
  compile "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}"
  compile "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}"
}
上一篇下一篇

猜你喜欢

热点阅读