Use Serial over USB


#1

Hi,

I want to use the USB(OTG) of my mobile to connect an external sensor.
I downloaded the inventit serial lib and imported it.

Following error:

Build folder: /tmp/android3025816262146606534sketch
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:processDebugResources/home/chef/.gradle/caches/transforms-1/files-1.1/design-26.0.2.aar/2ef8d6e150681bb2d40be44cc2bffdb9/res/values/values.xml:245:5-97: AAPT: error: resource attr/colorPrimary (aka processing.test.serial_test_02:attr/colorPrimary) not found.

/home/chef/.gradle/caches/transforms-1/files-1.1/design-26.0.2.aar/2ef8d6e150681bb2d40be44cc2bffdb9/res/values/values.xml:256:5-258:13: AAPT: error: resource attr/colorAccent (aka processing.test.serial_test_02:attr/colorAccent) not found.

/home/chef/.gradle/caches/transforms-1/files-1.1/design-26.0.2.aar/2ef8d6e150681bb2d40be44cc2bffdb9/res/values/values.xml:256:5-258:13: AAPT: error: resource attr/selectableItemBackground (aka processing.test.serial_test_02:attr/selectableItemBackground) not found.

Source:

import io.inventit.processing.android.serial.*;

Serial myPort; // The serial port
PFont myFont; // The display font
String inString; // Input string from serial port
int lf = 10; // ASCII linefeed

void setup() {
size(400,200);
// You’ll need to make this font with the Create Font Tool
myFont = loadFont(“FreeMonoBold-48.vlw”);
textFont(myFont, 18);
// List all the available serial ports:
printArray(Serial.list(this));
// I know that the first port in the serial list
myPort = new Serial(this, Serial.list(this)[0], 9600);
myPort.bufferUntil(lf);

// Create a new file in Sketch directory
output = createWriter(“serialdata.txt”);

}

void draw() {
background(0);
text("received: " + inString, 10,50);
}

void serialEvent(Serial p) {
inString = p.readString();
output.println(inString);
output.flush(); // Writes the remaining data to the file
output.close(); // Finishes the file

}

Has somebody an idea?

Android: 4.4.2
Ubuntu Kernel 4.15.0
Processing 3.4


#2

@Waldhuhn===
at first look (but perhaps i am wrong!) this error does not involve your lib but the material design dependency from appCompat, which is supposed to run with your os version. When you compile some sketch without the lib are you getting some error?


#3

Hi akenaton,

you’re right, it seems like a problem with Linux.
I tried a android example “AdditiveWaves” and I get also an built error.
I did the same on Win7 and it works.
Reason? I have no idea.