Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing sketch won't open on android device. #729

Open
powerm9 opened this issue Feb 28, 2023 · 11 comments
Open

Processing sketch won't open on android device. #729

powerm9 opened this issue Feb 28, 2023 · 11 comments

Comments

@powerm9
Copy link

powerm9 commented Feb 28, 2023

I can't run any sketch on my device, even the tutorial code. The code builds and I can see the sketch on my homepage but it crashes on startup. This is my first time using Processing for Android. My phone is a Xiaomi Redmi Mi 9t.

Tutorial code:

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
    }
  }
}

Here is the error code:

FATAL EXCEPTION: main
Process: processing.test.sketch_230228a, PID: 18243
java.lang.VerifyError: Rejecting class processing.a2d.PSurfaceAndroid2D that attempts to sub-type erroneous class processing.core.PSurfaceNone (declaration of 'processing.a2d.PSurfaceAndroid2D' appears in /data/app/~~pbDTqMMEtdX3RM-7t2y1gg==/processing.test.sketch_230228a-BovUAs_i6QCNcpIiUa_xtw==/base.apk)
	at processing.a2d.PGraphicsAndroid2D.createSurface(PGraphicsAndroid2D.java:180)
	at processing.core.PApplet.initSurface(PApplet.java:538)
	at processing.android.PFragment.onCreateView(PFragment.java:149)
	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
	at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
	at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
	at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
	at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
	at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
	at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
	at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
	at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
	at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
	at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
	at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
	at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
	at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210)
	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
	at android.app.Activity.performStart(Activity.java:8188)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3573)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2154)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:236)
	at android.app.ActivityThread.main(ActivityThread.java:8107)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.VerifyError: Verifier rejected class processing.core.PSurfaceNone: android.content.Context processing.core.PSurfaceNone.getContext() failed to verify: android.content.Context processing.core.PSurfaceNone.getContext(): [0x22]  can't resolve returned type 'Reference: android.content.Context' or 'Unresolved Reference: android.support.wearable.watchface.WatchFaceService' (declaration of 'processing.core.PSurfaceNone' appears in /data/app/~~pbDTqMMEtdX3RM-7t2y1gg==/processing.test.sketch_230228a-BovUAs_i6QCNcpIiUa_xtw==/base.apk)
	... 31 more

Edit: Just tried in my friend's phone and it worked. I don't know why my phone's not working though.

@codeanticode
Copy link
Member

That's odd. What version of Processing and the Android mode are you using?

@powerm9
Copy link
Author

powerm9 commented Apr 2, 2023

Android Studio 2022.1.1
Processing 4

I actually got a new phone recently, and it all works on that.

@vsquared
Copy link

vsquared commented Apr 17, 2023

I have two Android tablets connected to my system: old Galaxy S2, new Galaxy A8. The following code runs ok on the S2, but fails on the A8 with the same error message as that shown above. Processing version is 4.2.

void setup() {
  fullScreen();
  background(209);
}

void draw() {  
}

Error message for A8:
A8

@ajavamind
Copy link

ajavamind commented Apr 17, 2023

I ran into a similar problem using Android Mode 4.5 (version 410) recently.
I built a sketch for a tablet with Android API 15 (4.0.4) and the verify error appeared.
The minimum target SDK is API 17 in Android Mode 410.
I found it could not verify any class using the AppComponent.WATCHFACE.
I built my own Android Mode library commenting out all AppComponent.WATCHFACE and references to watchface from PSurfaceNone.java, PSurfaceAndroid2D.java, PSurfaceGLES.java

I would like to continue to use Processing Android with old Android devices (10+ years).
Tried to attached the modified AndrodeMode.zip file I built, but it is too big.

I made a repository with zip file at https://github.com/ajavamind/processing-android-410-api-15

@vsquared
Copy link

@ajavamind Thank you very much for your contribution; it appears that you solved the problem. I downloaded your zip file and placed it in the 'modes' folder of my Documents/Processing folder (macOS). I was then able to run a simple sketch on the new Galaxy A8 tablet without error using your version of AndroidMode.

@vsquared
Copy link

vsquared commented Apr 20, 2023 via email

@ajavamind
Copy link

Processing android mode does not support javafx, issue #736 #736

@vsquared
Copy link

vsquared commented Apr 20, 2023 via email

@kauron
Copy link

kauron commented Jun 6, 2023

I have the same problem. Here is my configuration:

  • Device: Samsung Galaxy Note 4 (Android 11 -- LineageOS)
  • Processing: 4.2.1 (installed from AUR in ArchLinux)
  • SDK Platform tools version: 34.0.3
  • Android Mode for Processing: 4.5.1

I will try with other devices and versions of Android.

Edit: it works correctly in a Huawei P20 Lite (ANE-LX1) with Android 9.1 (stock)

@bagnacauda
Copy link

bagnacauda commented Jul 11, 2023

Same here, with a Poco X3 Pro and LineageOS (could that be the reason?)

@tomjuggler
Copy link

@ajavamind your fix worked for me! Android fragmentation getting me down lately..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants