Loading...
Logo
Processing Forum

Hi all
Can anyone help me to solve build error when implementing NyARToolkit library in Android mode. 
For video I used ketai library. It did not work and give me error message like below

BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:881: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:883: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:895: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:290: null returned: 2

Total time: 17 seconds


Can anyone help me?

I tried it with processing 2.0b7 in both Mac and PC.



Copy code



  1. import ketai.camera.*;
  2. import jp.nyatla.nyar4psg.*;



  3. KetaiCamera cam;
  4. SingleARTKMarker nya;

  5. void setup() {
  6.   orientation(LANDSCAPE);
  7.   colorMode(RGB, 100);
  8.   cam = new KetaiCamera(this, 320, 240, 24);//cam=new Capture(this,width,height);
  9.   nya=new SingleARTKMarker(this,640,480,"camera_para.dat"); 
  10.   nya.setARCodes("patt.hiro",80);

  11.   cam.start();
  12. }


  13. void onCameraPreviewEvent()
  14. {
  15.   cam.read();
  16. }


  17. void draw() {


  18.   cam.read();
  19.   nya.drawBackground(cam);
  20.   switch(nya.detect(cam)){
  21.   case SingleARTKMarker.ST_NOMARKER:
  22.     return;
  23.   case SingleARTKMarker.ST_NEWMARKER:
  24.     //println("Marker found.");
  25.     return;
  26.   case SingleARTKMarker.ST_UPDATEMARKER:
  27.     break;
  28.   case SingleARTKMarker.ST_REMOVEMARKER:
  29.     //println("Marker removed.");
  30.     return;
  31.   default:
  32.     return;
  33.   }
  34.   nya.beginTransform();
  35.   {
  36.     setMatrix(nya.getMarkerMatrix());
  37.     drawBox();
  38.   }
  39.   nya.endTransform(); 

  40.   
  41. }
  42. void drawBox()
  43. {
  44.   pushMatrix();
  45.   fill(0);
  46.   stroke(255,200,0);
  47.   translate(0,0,20);
  48.   box(40);
  49.   noFill();
  50.   translate(0,0,-20);
  51.   rect(-40,-40,80,80); 
  52.   popMatrix();
  53. }


  54. void mousePressed()
  55. {
  56.   if (cam.isStarted())
  57.   {
  58.     cam.stop();
  59.   }
  60.   else
  61.     cam.start();
  62. }
  63. void keyPressed() {
  64.   if (key == CODED) {
  65.     if (keyCode == MENU) {
  66.       if (cam.isFlashEnabled())
  67.         cam.disableFlash();
  68.       else
  69.         cam.enableFlash();
  70.     }
  71.   }
  72. }



Replies(3)

I am also troubled by the same problem.
Please help something better.
There should have been more error messages in the console than just those you mentioned.

If you copy/paste EVERYTHING what was in the console (even what scrolled up) then it should help better to understand the cause.

Copy code
  1. BUILD FAILED
    C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:881: The following error occurred while executing this line:
    C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:883: The following error occurred while executing this line:
    C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:895: The following error occurred while executing this line:
    C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:290: null returned: 2
Hi everyone!! 

I'm also getting the same build failed error for a sketch I have, using NYARtoolkit in Android Mode, Processing 2.0.3., sending it to the device through USB. I could use and test other libraries successfully. Thanks for your time!!

I think the other part of the error is this (The exception is on line 18):


Copy code
  1. -dex:
  2. input: C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\bin\classes
  3. input: C:\Program Files (x86)\Android\android-sdk\tools\support\annotations.jar
  4. input: C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyARToolkit.jar
  5. input: C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyAR4psg.jar
  6. input: C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyAR4psg2b.jar
  7. input: C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\processing-core.jar
  8. Pre-Dexing C:\Program Files (x86)\Android\android-sdk\tools\support\annotations.jar -> annotations-62bab95d6948a2db17bbc7976160b014.jar
  9. Pre-Dexing C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyARToolkit.jar -> NyARToolkit-a1ca67de4b0be609cdfc3808f75908d9.jar
  10. Pre-Dexing C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyAR4psg.jar -> NyAR4psg-a5fa734a0c058ffbaa5475f9d041845b.jar
  11. Pre-Dexing C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\NyAR4psg2b.jar -> NyAR4psg2b-4129067716bd4f0fe27c4a9a2c860a21.jar
  12. Pre-Dexing C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\libs\processing-core.jar -> processing-core-19ea1975e2e5fb8fc5f162fd1435bd4e.jar
  13. Converting compiled files and external libraries into C:\Users\Xian\AppData\Local\Temp\android6634307391997637394sketch\bin\classes.dex...
  14.        [dx] Merged dex A (8 defs/8.2KiB) with dex B (2 defs/1.1KiB). Result is 10 defs/10.2KiB. Took 0.0s
  15.        [dx] Merged dex A (10 defs/10.2KiB) with dex B (329 defs/371.1KiB). Result is 339 defs/483.4KiB. Took 0.1s
  16.        [dx] Merged dex A (339 defs/483.4KiB) with dex B (13 defs/31.4KiB). Result is 352 defs/688.6KiB. Took 0.1s
  17.        [dx] 
  18.        [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
  19.        [dx] com.android.dx.util.DexException: Multiple dex files define Ljp/nyatla/nyar4psg/MultiMarker$PImageSensor;
  20.        [dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
  21.        [dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
  22.        [dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
  23.        [dx] at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
  24.        [dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
  25.        [dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
  26.        [dx] at com.android.dx.command.dexer.Main.run(Main.java:232)
  27.        [dx] at com.android.dx.command.dexer.Main.main(Main.java:174)
  28.        [dx] at com.android.dx.command.Main.main(Main.java:91)
  29.        [dx] 

  30. BUILD FAILED
  31. C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:884: The following error occurred while executing this line:
  32. C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:886: The following error occurred while executing this line:
  33. C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:898: The following error occurred while executing this line:
  34. C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:281: null returned: 2

  35. Total time: 16 seconds