stackex stackex - 5 months ago 103
Android Question

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

I want to integrate zxing scanner into my app without needed of external application (zxing scanner from play store). This is my code

Button scan = (Button) findViewById(;
scan.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, SCANNER_REQUEST_CODE);

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == SCANNER_REQUEST_CODE) {
// Handle scan intent
if (resultCode == Activity.RESULT_OK) {
// Handle successful scan
String contents = intent.getStringExtra("SCAN_RESULT");
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
Integer orientation = (intentOrientation == Integer.MIN_VALUE) ? null : intentOrientation;
String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");

} else if (resultCode == Activity.RESULT_CANCELED) {
// Handle cancel
} else {
// Handle other intents



<activity android:name=""
<action android:name=""/>
<category android:name="android.intent.category.DEFAULT"/>

My Android Studio said that cannot resolve symbol:
and if I run this, error happened

(java.lang.ClassNotFoundException: Didn't find class "")

What happened?


I don't know why it happened, but finally I use another library. I use Zxing-android-minimal and tutorial from here and here. Now it works.