How to include Zxing library to android project?

前提是你 提交于 2019-12-03 13:21:09

There is indeed an Android application that is part of the ZXing project. It uses the core module released in maven central. If you have a maven project (which is unlikely for most Android applications) you can add the following dependency to your pom.xml file:

<dependency>
    <groupId>com.google.zxing</groupId>
    <artifactId>core</artifactId>
    <version>3.2.0</version>
</dependency>

for a Gradle project:

compile 'com.google.zxing:core:3.2.0'

or you can directly download the compiled .jar from here.

Please, notice that this answer refers to version 3.2.0 which is the latest stable one. Version 2.2 could be similarly obtained.

For QRCode reading you can also use Google Play service 7.8 and beyond. You may check this link from Google.

What you should do is to include a jar, you can not be downloaded. At first when you try to take zxing had the same problem, luckily I found the jar and I could download it. You have to verify either version which you need.

core

I have not worked in Android Studio, this is in eclipse but I imagine it must be the same way.

What you need to add it is the full project zxing to your project as a library to the main project. Activity and create a layout that include this library.

Which is also the default is:

public class Validador extends CaptureActivity {

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.validador);
}

}

Layout :

<FrameLayout
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:layout_gravity="center">
    <include layout="@layout/capture"/>
</FrameLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!