在Ubuntu上将ZXing项目导入Android Studio

时间:2015-02-07 19:09:03

标签: android zxing

我是Android开发的新手。我只是设置环境并使用Android Studio。 如描述;

Integrate ZXing in Android Studio

我已将ZXing-2.3.0项目导入Android Studio,并将core-3.1.0.jar作为库添加到项目中,但在尝试构建项目时仍然会收到以下错误消息。可能是什么问题?

> Information:Using javac 1.7.0_65 to compile java sources
> Information:java: Errors occurred while compiling module 'main5'
> Information:Compilation completed with 53 errors and 0 warnings in 15
> sec Information:53 errors Information:0 warnings
> /home/korhan/Android/libraries/zxing-2.3.0/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
> Error:(26, 19) java: package android.app does not exist Error:(27, 19)
> java: package android.app does not exist Error:(28, 23) java: package
> android.content does not exist Error:(29, 23) java: package
> android.content does not exist Error:(30, 23) java: package
> android.content does not exist Error:(31, 26) java: package
> android.content.pm does not exist Error:(32, 26) java: package
> android.content.pm does not exist Error:(33, 19) java: package
> android.net does not exist Error:(34, 18) java: package android.os
> does not exist Error:(35, 20) java: package android.util does not
> exist Error:(141, 17) java: cannot find symbol   symbol:   class
> Activity   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(149, 27)
> java: cannot find symbol   symbol:   class Activity   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(233, 16)
> java: cannot find symbol   symbol:   class AlertDialog   location:
> class com.google.zxing.integration.android.IntentIntegrator
> Error:(245, 16) java: cannot find symbol   symbol:   class AlertDialog
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(283, 41) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(287, 39) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(300, 44) java: cannot find symbol   symbol:   class ResolveInfo
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(310, 11) java: cannot find symbol   symbol:   class AlertDialog
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(351, 83) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(376, 16) java: cannot find symbol   symbol:   class AlertDialog
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(389, 16) java: cannot find symbol   symbol:   class AlertDialog
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(411, 33) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(246, 5) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(246, 29) java: cannot find symbol   symbol:   class Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(247, 28) java: cannot find symbol   symbol:   variable Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(267, 25) java: cannot find symbol   symbol:   variable Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(268, 25) java: cannot find symbol   symbol:   variable Intent  
> location: class com.google.zxing.integration.android.IntentIntegrator
> Error:(288, 5) java: cannot find symbol   symbol:   class
> PackageManager   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(289, 10)
> java: cannot find symbol   symbol:   class ResolveInfo   location:
> class com.google.zxing.integration.android.IntentIntegrator
> Error:(289, 72) java: cannot find symbol   symbol:   variable
> PackageManager   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(301, 10)
> java: cannot find symbol   symbol:   class ResolveInfo   location:
> class com.google.zxing.integration.android.IntentIntegrator
> Error:(311, 16) java: package AlertDialog does not exist Error:(311,
> 57) java: package AlertDialog does not exist Error:(314, 68) java:
> package DialogInterface does not exist Error:(335, 67) java: package
> DialogInterface does not exist Error:(353, 25) java: cannot find
> symbol   symbol:   variable Activity   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(390, 5)
> java: cannot find symbol   symbol:   class Intent   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(390, 25)
> java: cannot find symbol   symbol:   class Intent   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(391, 24)
> java: cannot find symbol   symbol:   variable Intent   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(400, 21)
> java: cannot find symbol   symbol:   variable Intent   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(401, 21)
> java: cannot find symbol   symbol:   variable Intent   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(426, 35)
> java: cannot find symbol   symbol:   class Bundle   location: class
> com.google.zxing.integration.android.IntentIntegrator Error:(427, 31)
> java: cannot find symbol   symbol:   class Bundle   location: class
> com.google.zxing.integration.android.IntentIntegrator
> /home/korhan/Android/libraries/zxing-2.3.0/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegratorV30.java
> Error:(19, 19) java: package android.app does not exist Error:(20, 23)
> java: package android.content does not exist Error:(29, 17) java:
> cannot find symbol   symbol:   class Fragment   location: class
> com.google.zxing.integration.android.IntentIntegratorV30 Error:(34,
> 30) java: cannot find symbol   symbol:   class Fragment   location:
> class com.google.zxing.integration.android.IntentIntegratorV30
> Error:(40, 41) java: cannot find symbol   symbol:   class Intent  
> location: class
> com.google.zxing.integration.android.IntentIntegratorV30
> /home/korhan/Android/libraries/zxing-2.3.0/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegratorSupportV4.java
> Error:(18, 23) java: package android.content does not exist Error:(19,
> 30) java: package android.support.v4.app does not exist Error:(28, 17)
> java: cannot find symbol   symbol:   class Fragment   location: class
> com.google.zxing.integration.android.IntentIntegratorSupportV4
> Error:(33, 36) java: cannot find symbol   symbol:   class Fragment  
> location: class
> com.google.zxing.integration.android.IntentIntegratorSupportV4
> Error:(39, 41) java: cannot find symbol   symbol:   class Intent  
> location: class
> com.google.zxing.integration.android.IntentIntegratorSupportV4

1 个答案:

答案 0 :(得分:1)

这些是非常古老的指示。项目文档可能会提供更多帮助。 https://github.com/zxing/zxing/wiki/Getting-Started-Developing您应该使用最新版本,而不是2.3。

我不清楚你要做什么。在这里,您已下载源代码并尝试直接将其作为项目打开。该错误意味着它所说的内容:您没有将项目设置为依赖于库所需的任何库,例如Android。相反,您应该导入Maven构建。

但是你说你正在添加核心.jar文件,但是来自完全不同的版本3.1.0。发生了什么事?