Emulator doesn't work

Hi every one;

I’m a new user of android processing, i added this last mode (android) but when I tried to do a simple emulation based on the emulator by lunchinh this simple started programme
void setup() {
fullScreen();
noStroke();
fill(0);
}

void draw() {
background(204);
if (mousePressed) {
if (mouseX < width/2) {
rect(0, 0, width/2, height); // Left
} else {
rect(width/2, 0, width/2, height); // Right
}
}
}

%%%%%%%%%%%%%%%%
the software display this messsage “lost connection with emulator while launching. try again”

and display as follow:

Build folder: C:\Users\start\AppData\Local\Temp\android943141544518804092sketch

Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild
Task :app:compileDebugAidl
Task :app:compileDebugRenderscript
Task :app:checkDebugManifest
Task :app:generateDebugBuildConfig
Task :app:prepareLintJar
Task :app:generateDebugResValues
Task :app:generateDebugResources
Task :app:mergeDebugResources
Task :app:createDebugCompatibleScreenManifests
Task :app:processDebugManifest
Task :app:splitsDiscoveryTaskDebug
Task :app:processDebugResources
Task :app:generateDebugSources
Task :app:javaPreCompileDebug
Task :app:compileDebugJavaWithJavac
Task :app:compileDebugNdk NO-SOURCE
Task :app:compileDebugSources
Task :app:mergeDebugShaders
Task :app:compileDebugShaders
Task :app:generateDebugAssets
Task :app:mergeDebugAssets
Task :app:extractTryWithResourcesSupportJarDebug
Task :app:transformClassesWithStackFramesFixerForDebug
Task :app:transformClassesWithDesugarForDebug
Task :app:transformClassesWithDexBuilderForDebug
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug
Task :app:transformDexArchiveWithDexMergerForDebug
Task :app:mergeDebugJniLibFolders
Task :app:transformNativeLibsWithMergeJniLibsForDebug
Task :app:processDebugJavaRes NO-SOURCE
Task :app:transformResourcesWithMergeJavaResForDebug
Task :app:validateSigningDebug
Task :app:packageDebug
Task :app:assembleDebug

BUILD SUCCESSFUL in 28s
28 actionable tasks: 28 executed
Shutting down any existing adb server… Done.

%%%%%%%%%%ù
the emulator didn’t work and based on the device connection of my phone also didn’t work dispeat if following the instruction exactely as given by the processing team

please help me to start

Sometimes you need another emulator, it has given me a lot of headaches as well, and I prefer the USB connection. You have to install the correct driver of your device and even then it almost only works with the port on the back of the PC.
Mostly I work with the APDE app. It compiles within seconds.

@kobz ===
if you are starting with Android use USB (or APDE as @noel says) and forget the emulator; creating an emulator (if you want to test your app with different devices) can be useful but it is not easy because you have to understand and know a lot of things about android before…As for your problem your code seems to be good, it s only a question of connection with the emulator and that can occur for a lot of (mysterious!) reasons.As for me i have seen that the best way was to launch the emulator before and then try to compile but finally i left the emulators for real phones…