# Problem with running a simple sketch on Android

**URL:** <https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732>\
**Category:** Processing for Android\
**Created:** [January 28, 2023, 6:54pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732 "2023-01-28T18:54:58Z")\
**Posts on this page:** 14\
**Page:** 3

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 3, 2023, 3:35pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/41 "2023-02-03T15:35:35Z")

</div>

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

 ![dependency](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/9/b/9bb78230eb25d21fe1ae6ac3fd985891ed892c49.png)

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.

---

<div class="post-metadata">

**Author:** ![Glenton](https://avatars.discourse-cdn.com/v4/letter/g/8edcca/32.png) [@Glenton](https://discourse.processing.org/u/Glenton)\
**Post date:** [February 3, 2023, 10:04pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/42 "2023-02-03T22:04:07Z")

</div>

I remember I have had the same problem. I fixed it thank to [this discussion](https://stackoverflow.com/a/48568275/3457435).  
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](https://i.stack.imgur.com/qNCVI.png)](https://i.stack.imgur.com/qNCVI.png)

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 25, 2023, 1:45am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/43 "2023-02-25T01:45:11Z")

</div>

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 `

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 25, 2023, 6:52am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/44 "2023-02-25T06:52:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 25, 2023, 12:26pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/45 "2023-02-25T12:26:13Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 25, 2023, 5:12pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/46 "2023-02-25T17:12:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 26, 2023, 5:17am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/47 "2023-02-26T05:17:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 26, 2023, 6:57am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/48 "2023-02-26T06:57:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 26, 2023, 7:56am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/49 "2023-02-26T07:56:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 26, 2023, 8:36am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/50 "2023-02-26T08:36:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 26, 2023, 10:50am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/51 "2023-02-26T10:50:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 26, 2023, 4:54pm UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/52 "2023-02-26T16:54:51Z")

</div>

Do you have these platforms in your Sdk folder:

 ![platforms](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/8/48f85dbc7674699ffc2323f6a6dbbe130a52216d.png)

---

<div class="post-metadata">

**Author:** ![dmdbilal](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmdbilal](https://discourse.processing.org/u/dmdbilal)\
**Post date:** [February 27, 2023, 12:58am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/53 "2023-02-27T00:58:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 27, 2023, 1:30am UTC](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732/54 "2023-02-27T01:30:09Z")

</div>

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

[Previous page](https://discourse.processing.org/t/problem-with-running-a-simple-sketch-on-android/40732.md?page=2)
