1

I was trying to using ZXing as an external library for my project. I follow the step of this site

It runs well on Eclipse, but, the APK created by Ant stops and show the following message in Logcat:

FATAL EXCEPTION: main
09-23 16:54:44.816: E/AndroidRuntime(7570): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN pkg=remote.iWatchDVR (has extras) }
09-23 16:54:44.816: E/AndroidRuntime(7570):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1580)
09-23 16:54:44.816: E/AndroidRuntime(7570):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)

Manifest:

<activity android:name="com.google.zxing.client.android.CaptureActivity"
    android:screenOrientation="landscape"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:windowSoftInputMode="stateAlwaysHidden">
   <intent-filter>
      <action android:name="com.google.zxing.client.android.SCAN"/>
      <category android:name="android.intent.category.DEFAULT"/>
   </intent-filter>
</activity>

Intent:

Button qrcode = (Button) findViewById(R.id.button_qrcode);
qrcode.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.setPackage(v.getContext().getResources().getString(R.string.rootPackName));
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, REQUEST_QRCODE);
    }
});

I followed the steps explained in Class not found when using zxing, but the ant build failed after I copied zxing2.1.jar into /libs

[dx] 
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define            Lcom/google/zxing/client/android/BeepManager$1;
[dx]    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
[dx]    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
[dx]    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)

I'm confused about configuring paths or settings for Ant.

Community
  • 1
  • 1

1 Answers1

0

The last build error shows that com.google.zxing.client.android referenced more than twice. Check on your build.grandle file on the compile and you will see two references of zxing package

Kevin Kaburu
  • 504
  • 4
  • 19