zoukankan      html  css  js  c++  java
  • Zxing 的集成 ---- Maven 对应 Gradle 的写法

    Zxing 的集成 ---- Maven 对应 Gradle 的写法

    刚刚想耍耍二维码,想到了zxingzbar,又想到zxingGoogle老爹的,想想就算了吧,虽然zbar快但是识别错误率也高不少.随手Google了下*zxing 集成*好像都是说什么拷贝项目到自己的工程中,我不信Gradle集成这么方便了为何不用.于是我来到zxing的 Github 主页 https://github.com/zxing/zxing,在README的引导下来到Get Start页面,里面有如下说明:

    Maven
    
    core/, javase/, android-integration and zxingorg can be used directly in a Maven-based project without any download or installation. Instead, add as dependencies from groupID com.google.zxing artifactIDs core, javase, android-integration or zxingorg:
    
    <dependencies>
      ...
      <dependency>
        <groupId>com.google.zxing</groupId>
        <artifactId>core</artifactId>
        <version>(the current version)</version>
      </dependency>
    </dependencies>
    
    

    虽然没说明 Gradle 如何集成,但是发布过lib到jcenter的应该知道,mavenGradle的关系.

    上面maven仓库信息对应的Gradle为:

    compile 'com.google.zxing:core:3.3.0'
    
    compile '<groupId>:<artifactId>:<version>'
    
    

    记起来也很简单,就是把上面三个参数用:连接即可.

    其中 version对应版本有很多,建议使用最新的,我现在看到最新的Release版本为3.3.0.

    所以在 Android studio 的工程 Modulebuild.gradle下添加一行依赖即可:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:support-v4:25.3.1'
        compile 'com.android.support:design:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        testCompile 'junit:junit:4.12'
        //添加 zxing
        compile 'com.google.zxing:core:3.3.0'
    }
    

    其他的项目集成以此类推.

  • 相关阅读:
    linux 短信收发
    sama5d3 环境检测 adc测试
    【Codeforces 723C】Polycarp at the Radio 贪心
    【Codeforces 723B】Text Document Analysis 模拟
    【USACO 2.2】Preface Numbering (找规律)
    【Codeforces 722C】Destroying Array (数据结构、set)
    【USACO 2.1】Hamming Codes
    【USACO 2.1】Healthy Holsteins
    【USACO 2.1】Sorting A Three-Valued Sequence
    【USACO 2.1】Ordered Fractions
  • 原文地址:https://www.cnblogs.com/didikee/p/6926337.html
Copyright © 2011-2022 走看看