【问题标题】:How to integrate Zxing in Android Studio into android project without installing external Zxing app如何在不安装外部 Zxing 应用的情况下将 Android Studio 中的 Zxing 集成到 android 项目中
【发布时间】:2016-01-29 02:40:36
【问题描述】:

我正在尝试制作一个应该能够扫描条形码的应用程序。它应该可以在不安装外部 Zxing 应用程序的情况下工作。我已经搜索了答案并找到了这个:

How to integrate Zxing Barcode Scanner without installing the actual zxing app (cannot resolve symbol: .android.CaptureActivity)?

答案是指 Eclipse,但如果尝试在 Android Studio 中做同样的事情,我不知道从哪里开始。

【问题讨论】:

  • 如果你向下滚动到你链接的帖子的底部,你会发现一个 gradle 兼容的项目:github.com/journeyapps/zxing-android-embedded 或者你可以将原始项目导入 Android Studio 并在 gradle 中使用 compile files:
  • 我试过了,但不知道如何在Android Studio中导入。

标签: android android-studio zxing


【解决方案1】:

尝试将其添加到您的 build.gradle 文件中

dependencies {

    // other dependencies

    // ZXing
    // Supports Android 4.0.3 and later (API level 15)
    compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar'

    // Convenience library to launch the scanning and encoding Activities.
    // It automatically picks the best scanning library from the above two, depending on the
    // Android version and what is available.
    compile 'com.journeyapps:zxing-android-integration:2.0.1@aar'

    // Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
    // This mostly affects encoding, but you should test if you plan to support these versions.
    // Older versions e.g. 2.2 may also work if you need support for older Android versions.
    compile 'com.google.zxing:core:3.2.1'

}

【讨论】:

  • 我必须以某种方式导入项目吗?如果是,我应该怎么做?我不明白模块的想法。
猜你喜欢
  • 2013-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-06
  • 1970-01-01
  • 2015-06-13
相关资源
最近更新 更多