Error from inside the Android tools, check the console

edited July 7 in Android Mode

Hello everyone,

Like many others I am encountering "Error from inside the Android tools, check the console" when trying to run my sketch on my device. My phone is running Android 4.4.2, I am using Processing 3.3.4. I am a beginner with all this but I will try to explain my setup and problem as well as I can...

I am using the Android serial library and Twitter4j – the phone will be communicating with an Arduino Mega via serial. My code runs fine on my Mac (with the regular processing serial library), but my code won't build in Android Mode. The Android code examples build and install fine on my Android.

When I try to run on device, the build stops after around 35 seconds.

This is from the output:

    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin
     [echo] org.eclipse.jdt.core.JDTCompilerAdapter

-set-mode-check:

-set-debug-files:

-check-env:
Android SDK Tools Revision 25.2.5
Installed at /Users/klaravan/Documents/Processing/modes/AndroidMode/sdk

-setup:
     [echo] Project Name: THERMAL_PRINTER_ANDROID
Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
Using latest Build Tools: 26.0.0
     [echo] Resolving Build Target for THERMAL_PRINTER_ANDROID...
Project Target:   Android 4.4.2
API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/res
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/rsObj
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/rsLibs
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/gen
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/classes
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for THERMAL_PRINTER_ANDROID...
Library dependencies:
No Libraries

------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 4 source files to /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/classes

-post-compile:

-obfuscate:

-dex:
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/classes
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4jstream404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/usb-serial-for-android-b96f9ca.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/arduino.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4j404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4jmediasupport404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/slf4j-android-1.6.1-RC1.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/android-support-v4.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4j-core-4.0.4.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/AndroidSerial.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/processing-core.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4jasync404.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4jstream404.jar -> twitter4jstream404-842624e474271e1119dcc096c59d9787.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/usb-serial-for-android-b96f9ca.jar -> usb-serial-for-android-b96f9ca-226f408d8f00ded34ddf534a7c27f6f0.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/arduino.jar -> arduino-da1dc7a85994c2e8524323644c006aac.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4j404.jar -> twitter4j404-1061aae12996f11ede519dc5aefbe752.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/twitter4jmediasupport404.jar -> twitter4jmediasupport404-6bcaab2c12a9bde84258bd4b6590efb4.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/slf4j-android-1.6.1-RC1.jar -> slf4j-android-1.6.1-RC1-5f233d67026410b92fbe783ada9a1d79.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/libs/android-support-v4.jar -> android-support-v4-faf9b1f9fc4c7dc894b10e16174e6208.jar



       [dx] 
       [dx] trouble writing output: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android7943944345409819765sketch/bin/dexedLibs/android-support-v4-faf9b1f9fc4c7dc894b10e16174e6208.jar (No space left on device)

  [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin
     [echo] org.eclipse.jdt.core.JDTCompilerAdapter

-set-mode-check:

-set-debug-files:

-check-env:
Android SDK Tools Revision 25.2.5
Installed at /Users/klaravan/Documents/Processing/modes/AndroidMode/sdk

-setup:
     [echo] Project Name: THERMAL_PRINTER_ANDROID
Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
Using latest Build Tools: 26.0.0
     [echo] Resolving Build Target for THERMAL_PRINTER_ANDROID...
Project Target:   Android 4.4.2
API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/res
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/rsObj
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/rsLibs
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/gen
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/classes
    [mkdir] Created dir: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for THERMAL_PRINTER_ANDROID...
Library dependencies:
No Libraries

------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 4 source files to /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/classes

-post-compile:

-obfuscate:

-dex:
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/classes
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jstream404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/usb-serial-for-android-b96f9ca.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/arduino.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4j404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jmediasupport404.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/slf4j-android-1.6.1-RC1.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/android-support-v4.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4j-core-4.0.4.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/AndroidSerial.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/processing-core.jar
input: /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jasync404.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jstream404.jar -> twitter4jstream404-0218e8c2d4f7f50a4c9d24fd6b2caa03.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/usb-serial-for-android-b96f9ca.jar -> usb-serial-for-android-b96f9ca-c296376d20c5b25b56ddd2a878e668ee.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/arduino.jar -> arduino-569b6310889839e71c38941de06c0073.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4j404.jar -> twitter4j404-9dde1ece43921b247b7963f1b336fe5e.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jmediasupport404.jar -> twitter4jmediasupport404-990d2065f65866a495787d0710bd5dde.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/slf4j-android-1.6.1-RC1.jar -> slf4j-android-1.6.1-RC1-48314610ff6e9ec8894f0e75178e153f.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/android-support-v4.jar -> android-support-v4-2286ff6be82e7a679cf7283801014ee6.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4j-core-4.0.4.jar -> twitter4j-core-4.0.4-252d66578969888f70ca690a53595036.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/AndroidSerial.jar -> AndroidSerial-1073d5da2e571971de328ebb63c7dcc9.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/processing-core.jar -> processing-core-e0ab0e8be0caab6cb1fc70a3d2a09031.jar
Pre-Dexing /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/libs/twitter4jasync404.jar -> twitter4jasync404-e8dbb32dd6ccf77919cc67e83ad23912.jar
Converting compiled files and external libraries into /var/folders/1g/jdj0mvr913n_b53yfrwj7v8h0000gn/T/android1444489789936789373sketch/bin/classes.dex...
       [dx] 
       [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
       [dx] com.android.dex.DexException: Multiple dex files define Ltwitter4j/TwitterResponse;
       [dx]     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:608)
       [dx]     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:563)
       [dx]     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:545)
       [dx]     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)
       [dx]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:194)
       [dx]     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:506)
       [dx]     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:336)
       [dx]     at com.android.dx.command.dexer.Main.runDx(Main.java:291)
       [dx]     at com.android.dx.command.dexer.Main.main(Main.java:247)
       [dx]     at com.android.dx.command.Main.main(Main.java:94)
       [dx] 
Tagged:

Answers

  • I created a new sketch in a new directory and copied my code into it. It built alright and installed on my phone, but when I try to open it it stops immediately (Unfortunately, sketch_android has stopped.)

  • I am using the Android serial library and Twitter4j – the phone will be communicating with an Arduino Mega via serial. My code runs fine on my Mac (with the regular processing serial library), but my code won't build in Android Mode

    When you say it works in java, and not in Android Mode, we are not talking about the same code, right? Because the serial lib for java is not the same as the serial lib that you should be using for Android.

    but my code won't build in Android Mode. The Android code examples build and install fine on my Android.

    This is good information, that is, demo codes work fine in your device. This type of problems are high to debug as it is not possible to reproduce the problem since only you have the hardware (and the code). This is what you could do. Starting from a demo example from Processing Android, build a sample application that uses the Android serial library and taps into your device. If you still have a bug, then post your code and somebody could try to reproduce it. However this really depends if there are other ppl currently working in the Android serial mode domain. Another suggestion is to use a sample code from an online source that has been proven to work. Or search here in the forum for previous posts. Don't use the search engine in this forum but rather use Google as it performs way better for your case. Two links of interest:

    https://forum.processing.org/two/discussion/20489/serial-communication-between-android-and-pc#latest
    https://github.com/inventit/processing-android-serial

    Kf

  • Hi kfrajer, I am using different serial libraries, yes. I am going to test an android serial example now to see whether the problem lies there or if I can communicate with my Arduino. Thanks for the links + answer!

  • I have tried to run an android serial example (Arduino Input Mega + StandardFirmata on Arduino) and it doesn't launch on my phone.

    When I try to open my actual sketch on my phone without having connected an Arduino, I get an error message from Processing-Android USB Serial:

    Port: null Check the following items: 1. Make sure AndroidManifest.xml contains tag for android.hardware.usb.host 2. USB Serial is connected to the device

    I have modified my AndroidManifest.xml file, added the tag as well as the intent filter and a device_filter.xml file in the res/xml directory

      <intent-filter>
        <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/>
      </intent-filter>
      <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
        android:resource="@xml/device_filter" />
    

    I have also included the necessary permissions. I suppose the serial IS the problem, since other example sketches which do not use the serial libary/port work?

  • I just realised that the processing android serial library requires Android 5.0 or higher so I am now using a Samsung Galaxy S5 mini which is running 6.1.

    I also now noticed that before, my Arduino was powered through my phone, which means that the serial connection obviously wasn't working as the port was used for charging. With the other phone (6.1), the Arduino is not powered (I am powering through an external battery), so I guess that is a step forward. I am however receiving the error message form Processing-Android USB Serial everytime I try to launch the app now, even though the Arduino is connected. Any thoughts?

Sign In or Register to comment.