Problem with running a simple sketch on Android

Thanks. Got it; imported into AS but got this pesky dependency problem:

Any idea how I can fix that. I never know how to fix things like this in AS. I tried letting the app look on the web, but it said it couldn’t find it.

I remember I have had the same problem. I fixed it thank to this discussion.
There are other methods in this discussion but this is the one that worked for me : ( 1. From Build menu, select Edit Libraries and Dependancies, ect…)

enter image description here

I’ve now downloaded the processing 4.2 and run a simple program in a android device. But i’m getting these errors. Can someone suggest me a way to solve these issue.
org.json.JSONException: No value for spes at org.json.JSONObject.get(JSONObject.java:403) at org.json.JSONObject.getJSONObject(JSONObject.java:623) at android.util.MiuiMultiWindowUtils.initFreeFormResolutionArgsOfDevice(MiuiMultiWindowUtils.java:1433) at android.util.MiuiMultiWindowUtils.initFreeFormResolutionArgs(MiuiMultiWindowUtils.java:1427) at android.util.MiuiMultiWindowUtils.<clinit>(MiuiMultiWindowUtils.java:209) at android.util.MiuiMultiWindowUtils.isSupportMultiSwitchFeature(MiuiMultiWindowUtils.java:3351) at com.android.internal.policy.DecorViewMultiWinStubImpl.<init>(DecorViewMultiWinStubImpl.java:19) at com.android.internal.policy.DecorViewMultiWinStubImpl$Provider.provideNewInstance(DecorViewMultiWinStubImpl$Provider.java:14) at com.android.internal.policy.DecorViewMultiWinStubImpl$Provider.provideNewInstance(DecorViewMultiWinStubImpl$Provider.java:8) at com.miui.base.MiuiStubRegistry.get(MiuiStubRegistry.java:129) at com.miui.base.MiuiStubUtil.newInstance(MiuiStubUtil.java:77) at com.android.internal.policy.DecorViewMultiWinStub.newInstance(DecorViewMultiWinStub.java:11) at com.android.internal.policy.DecorView.<init>(DecorView.java:333) at com.android.internal.policy.PhoneWindow.generateDecor(PhoneWindow.java:2380) at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2760) at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2140) at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:864) at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:806) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:702) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:180) at processing.test.sketch_230225d.MainActivity.onCreate(MainActivity.java:21) at android.app.Activity.performCreate(Activity.java:8176) at android.app.Activity.performCreate(Activity.java:8143) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1330) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3744) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3938) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2291) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8309) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038) FATAL EXCEPTION: main Process: processing.test.sketch_230225d, PID: 18268 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/~~96y7IjPoX_kjRwAm1UPj3w==/processing.test.sketch_230225d-kTg-QQeT9B7MB8Oc8p__RA==/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:1456) at android.app.Activity.performStart(Activity.java:8208) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3796) 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:2291) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8309) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038) 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/~~96y7IjPoX_kjRwAm1UPj3w==/processing.test.sketch_230225d-kTg-QQeT9B7MB8Oc8p__RA==/base.apk) ... 32 more

It would help if you post the code which fails to run.

Hey, Processing software asks to download android sdk every time I open the application. I’ve already downloaded it yesterday. What should i do now ?

If Processing keeps asking for the sdk, apparently it doesn’t know where the sdk is located. Which operating system are you using?

I’ve already downloaded SDK automatically from processing and i’m currently using windows.

You may have downloaded the sdk but Processing can’t find the location, otherwise it wouldn’t keep asking for it. So what you need to do basically is find out where the sdk is located and then make certain that Processing’s preferences file is set to the same path. Do you have the app Android Studio on your system? It can be helpful in finding the sdk location if other methods fail.

On my Windows 11 system the Android sdk is located at: C:\Users\myName\AppData\Local\Android\Sdk
Processing preferences.txt file is at C:\Users\myName\AppData\Roaming\Processing\preferences.txt
Open the preferences file and set the correct sdk path for your system.

I’ve tried by changing the path in preference.txt to my current sdk location. Even after locating the sdk location in my computer it still doesn’t find the sdk.

Look back at the preferences.txt file to see if the correct path is still there. If you have Processing open when you change the file the changes won’t ‘stick’. Processing.app needs to be closed when the preferences.txt file is changed.

Even doing all the things right, I’m still getting the same error.

Do you have these platforms in your Sdk folder:

Yes I’ve all these platform inside the sdk folder.

Then it should work. That’s all of the suggestions I can think of at this moment.