如何将Zxing库集成到从Eclipse导入的Android Studio项目中

时间:2017-05-15 10:13:14

标签: android android-studio zxing

我已将Android Eclipse项目导入Android Studio。我的应用程序在Android eclipse中工作正常,但在Android Studio中显示以下错误:

    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\DecodeHandler.java
        Error:(99, 57) error: cannot find symbol method renderCroppedGreyscaleBitmap()

D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\encode\QRCodeEncoder.java
    Error:(303, 46) error: cannot find symbol method getURL()
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\result\AddressBookResultHandler.java
    Error:(137, 33) error: cannot find symbol method getURL()
    Error:(192, 36) error: cannot find symbol method getURL()
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\share\AppPickerActivity.java
    Error:(66, 30) error: cannot find symbol variable BookmarkColumns
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\share\BookmarkPickerActivity.java
    Error:(39, 14) error: cannot find symbol variable BookmarkColumns
    Error:(40, 14) error: cannot find symbol variable BookmarkColumns
    Error:(55, 48) error: cannot find symbol variable BOOKMARKS_URI
    Error:(71, 30) error: cannot find symbol variable BookmarkColumns
    Error:(72, 30) error: cannot find symbol variable BookmarkColumns
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\google\zxing\client\android\share\ShareActivity.java
    Error:(145, 58) error: cannot find symbol variable BookmarkColumns
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\mobileinvoicesignaturecs\controller\MapActivity.java
    Error:(41, 31) error: cannot find symbol method getMap()
    D:\WorkingFolder\MobileInvoiceSignatureCS\app\src\main\java\com\mobileinvoicesignaturecs\controller\Themes.java
    Error:(113, 36) error: cannot find symbol class BaseAdapter
    Error:(48, 13) error: no suitable method found for setAdapter(Themes.ThemeAdapter)
    method AdapterView.setAdapter(ListAdapter) is not applicable
    (argument mismatch; Themes.ThemeAdapter cannot be converted to ListAdapter)
    method AbsListView.setAdapter(ListAdapter) is not applicable
    (argument mismatch; Themes.ThemeAdapter cannot be converted to ListAdapter)
    method GridView.setAdapter(ListAdapter) is not applicable
    (argument mismatch; Themes.ThemeAdapter cannot be converted to [![enter image description here][1]][1]ListAdapter)
    Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.


  [1]: https://i.stack.imgur.com/uBGHN.png

1 个答案:

答案 0 :(得分:0)

在build.gradle文件@ app level中添加以下依赖项。

compile 'me.dm7.barcodescanner:zxing:1.9'

点击工具中的同步 - > Android->使用gradle文件同步项目。