【问题标题】:IntentIntegrator class is in zxing-android-embedded-4.1.0-sources.jar but unable to callIntentIntegrator 类在 zxing-android-embedded-4.1.0-sources.jar 但无法调用
【发布时间】:2020-03-03 14:38:44
【问题描述】:

我从这里下载zxing-android-embedded 4.1.0:https://repo.spring.io/plugins-release/com/journeyapps/zxing-android-embedded/4.1.0/

将此库添加到libs目录和sync后,该库可用:

正如你在图片中看到的 IntentIntegrator 类是存在的,但我不能使用这个代码:

IntentIntegrator integrator = new IntentIntegrator(activity);

我是 Android 新手,非常感谢您的帮助

注意: 我导入import com.google.zxing.integration.*; 我尝试通过将依赖项添加到build.gradle 来下载此库,但 gradle 无法下载它。我尝试了不同的存储库。

【问题讨论】:

    标签: android zxing


    【解决方案1】:

    您不必直接下载此库。取而代之的是,您可以将依赖项添加到您的 build.gradle 文件中,该文件位于您的 app 模块中。我已经尝试过了,IntentIntegrator 可用。

    dependencies {
        implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
    }
    

    另外,您必须将jcenter() 添加到项目级别的build.gradle 文件中:

    repositories {
        jcenter()
    }
    

    有关库配置的更多详细信息,您可以找到here

    【讨论】:

    • 我尝试通过将依赖项添加到build.gradle 来下载此库,但 gradle 无法下载它。我尝试了不同的存储库。
    • 谢谢@kostyabakay 但gradle 回复ERROR: Connection reset
    • @Masi 尝试以与 jcenter() 相同的方式添加 google()
    • 我添加了google()mavenCentral()gradle 返回:build.gradle: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.journeyapps:zxing-android-embedded:4.1.0.
    • @Masi 尝试禁用 Gradle 离线工作:转到文件->其他设置->默认设置->构建、执行、部署->构建工具->Gradle->取消选中离线工作选项跨度>
    猜你喜欢
    • 1970-01-01
    • 2015-12-27
    • 1970-01-01
    • 2015-05-23
    • 1970-01-01
    • 2014-04-10
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多