# How to locate my Android SDK in Processing 4.3?

**URL:** <https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655>\
**Category:** Processing for Android\
**Created:** [June 27, 2024, 5:42am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655 "2024-06-27T05:42:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [June 27, 2024, 5:42am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/1 "2024-06-27T05:42:15Z")

</div>

When I opened an Android sketch was asked to download or locate the SDK. Download automatically didn’t work. So I did the manual download using:  
[https://android.processing.org/tutorials/getting\_started/](https://android.processing.org/tutorials/getting_started/)  
and I ran the sdkmanager:

> **[sdkmanager  |  Android Studio  |  Android Developers](https://developer.android.com/tools/sdkmanager)**
>
> The sdkmanager is a command-line tool that allows you to view, install, update, and uninstall packages for the Android SDK.

Now I have directories like:  
cmdline-tools  
licenses  
platform-tools  
platforms

I’ve tried to point the SDK to different directories without luck. Any advice would be appreciated.

Windows 11, Prcoessing 4.3

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [June 27, 2024, 5:13pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/2 "2024-06-27T17:13:30Z")

</div>

Hi @bigboss97.  
If you are using the most recent version of Android mode it will not work on Windows currently.  
I’ve reported the bug here: [Error in line #408 AndroidSDK.java with Windows · Issue #768 · processing/processing-android · GitHub](https://github.com/processing/processing-android/issues/768)  
You have to use an older version for now. Due to Gradle issues with older versions I gave up and instead used Android Studio. There is a tutorial here on that here, [Processing for Android](https://android.processing.org/tutorials/android_studio/)

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [June 27, 2024, 11:33pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/3 "2024-06-27T23:33:10Z")

</div>

> [@robertesler](#):
>
> You have to use an older version for now. Due to Gradle issues with older versions I gave up and instead used Android Studio. There is a tutorial here on that here, [Processing for Android](https://android.processing.org/tutorials/android_studio/)

Thanks, I’ll install Android Studio and give it a try.  
I’ve tried to locate the command-line tool with Processing v4.1.1 and v4.3.

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [June 28, 2024, 7:34am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/4 "2024-06-28T07:34:40Z")

</div>

I’ve installed Android Studio. But I can’t find Java in language. What have I missed?

 ![Screenshot - 24-06-28 17.28.01](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/b/9/b9c529c13088bd43e3001fe927a6284d2020255c.png)

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [June 28, 2024, 5:21pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/5 "2024-06-28T17:21:07Z")

</div>

@bigboss97, what you are referring to is just the language Gradle uses for the build scripts. Gradle (Android’s build tool) will only use Kotlin or Groovy. Android projects can use Java or Kotlin. It’s confusing, but you shouldn’t have to interact with your build scripts very much. To use Java create a new java file by right-clicking on the …/src/main/java folder and select New → Java Class. I hope that helps get you started.

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [July 1, 2024, 2:28am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/6 "2024-07-01T02:28:44Z")

</div>

I’m totally new in Android Studio. Maybe I just wait for the fix or…  
According to [#768](https://github.com/processing/processing-android/issues/768), v4.5.1 would work. Do I have to build it myself?

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [July 2, 2024, 3:05pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/7 "2024-07-02T15:05:35Z")

</div>

You can find old releases of Android mode here, [Releases · processing/processing-android · GitHub](https://github.com/processing/processing-android/releases)  
You can download the files under “Assets” and manually install it by placing the folder in your “modes” folder.  
Android mode 4.5.1 doesn’t have the Windows issue with installing or locating the SDK so it may work. But I still had issues with Gradle and couldn’t build a sketch, which is probably a compatibility issue with Gradle 7 and 8. But I gave up and used Android Studio instead.

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [July 5, 2024, 7:57am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/8 "2024-07-05T07:57:23Z")

</div>

I’ve downloaded the [demo project](https://github.com/codeanticode/processing-android-tutorials/tree/master/android_studio/ex2_fragmentsv4). After a lot of fiddling around, I finally got something running on my Galaxy Z Flip:

 ![Screenshot - 24-07-05 17.48.20](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/9/2/9230b5e92c4dab13c4aadd5fae110a9dcea7c3dc.png)  
After launch, the app disappears to the task list and I can’t activate it. There’s no error message either. What can I try?

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [July 5, 2024, 11:56pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/9 "2024-07-05T23:56:15Z")

</div>

Hi @bigboss97. Check the LogCat (the cat image on left) to see if there are any errors or warnings. If so post those here. Also, do you have `public void onRequestPermissionsResult()` in your MainActivity?  
I don’t know if this is the problem but you don’t need the `public void settings()` method at all. It should default to full screen.  
Also, it wasn’t entirely clear, are running on an emulator or the device?

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [July 6, 2024, 12:55am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/10 "2024-07-06T00:55:43Z")

</div>

LogCat

```auto
FATAL EXCEPTION: main
Process: androidstudio.tutorials, PID: 7579
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{androidstudio.tutorials/androidstudio.tutorials.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "androidstudio.tutorials.MainActivity" on path: DexPathList[[dex file "/data/data/androidstudio.tutorials/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~or4zcKFQnuNshzrxOJgdeg==/androidstudio.tutorials-4RSLdCus4fJDrbNtaXq9SA==/base.apk"],nativeLibraryDirectories=[/data/app/~~or4zcKFQnuNshzrxOJgdeg==/androidstudio.tutorials-4RSLdCus4fJDrbNtaXq9SA==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4066)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4340)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
	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:2584)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8810)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidstudio.tutorials.MainActivity" on path: DexPathList[[dex file "/data/data/androidstudio.tutorials/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~or4zcKFQnuNshzrxOJgdeg==/androidstudio.tutorials-4RSLdCus4fJDrbNtaXq9SA==/base.apk"],nativeLibraryDirectories=[/data/app/~~or4zcKFQnuNshzrxOJgdeg==/androidstudio.tutorials-4RSLdCus4fJDrbNtaXq9SA==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
	at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:44)
	at android.app.Instrumentation.newActivity(Instrumentation.java:1339)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4053)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4340) 
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 
	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:2584) 
	at android.os.Handler.dispatchMessage(Handler.java:106) 
	at android.os.Looper.loopOnce(Looper.java:226) 
	at android.os.Looper.loop(Looper.java:313) 
	at android.app.ActivityThread.main(ActivityThread.java:8810) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) 

```

MainActivity.java

```auto
public class MainActivity extends AppCompatActivity {
  private PApplet sketch;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(CompatUtils.getUniqueViewId());
    setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                     ViewGroup.LayoutParams.MATCH_PARENT));

    sketch = new Sketch();
    PFragment fragment = new PFragment(sketch);
    fragment.setView(frame, this);
  }

  @Override
  public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    if (sketch != null) {
      sketch.onRequestPermissionsResult(
      requestCode, permissions, grantResults);
    }
    super.onRequestPermissionsResult( requestCode, permissions, grantResults);
  }

  @Override
  public void onNewIntent(Intent intent) {
    if (sketch != null) {
      sketch.onNewIntent(intent);
    }
    super.onNewIntent( intent);
  }
}

```

I’ve added _super.xyz()_ because the compiler was complaining.

I’m launching via USB to my Galaxy z flip (Android 13).

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [July 6, 2024, 10:45pm UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/11 "2024-07-06T22:45:23Z")

</div>

@bigboss97, that’s not a fun error to get , 😧  
This could be several things,  
Here is a link to several solutions to a similar problem, [java - Android ClassNotFoundException: Didn't find class on path - Stack Overflow](https://stackoverflow.com/questions/19523167/android-classnotfoundexception-didnt-find-class-on-path#22652153)  
It could also be a conflict between the name of your package in the AndroidManifest.xml, look at this, [Android ClassNotFoundException: Didn't find class on path - Stack Overflow](https://stackoverflow.com/questions/20924004/android-classnotfoundexception-didnt-find-class-on-path)  
I’m sure it’s a simple fix but can’t know without your full project.

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [July 7, 2024, 1:36am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/12 "2024-07-07T01:36:57Z")

</div>

@robertesler, thank you so much for your help 👍 I placed the two \*.java files in the right location and updated _package_ accordingly. Now it’s working, hooray!

 ![Screenshot - 24-07-07 11.27.34](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/e/ce2a739eabd00adee5f1f8fcf41654c682e374a9.png)

---

<div class="post-metadata">

**Author:** ![bigboss97](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bigboss97](https://discourse.processing.org/u/bigboss97)\
**Post date:** [July 7, 2024, 2:46am UTC](https://discourse.processing.org/t/how-to-locate-my-android-sdk-in-processing-4-3/44655/13 "2024-07-07T02:46:34Z")

</div>

I’ve written a note for myself and thought that might be useful for someone else, too.  
Following steps are based on the [instruction](https://android.processing.org/tutorials/android_studio/) and using Android Studio Koala 2024.1.1

1. New project: Empty Views Activity  
Package name: androidstudio.audiotest  
Language: Java
2. Copy processing-core.jar to app/libs
3. File → Project Structure → Dependencies  
add JAR: libs/processing-core.jar
4. Copy MainActivity.java & Sketch.java to app/src/main/java/androidstudio/audiotest

MainActivity.java

```auto
package androidstudio.audiotest;

import android.os.Bundle;
import android.content.Intent;
import android.view.ViewGroup;
import android.widget.FrameLayout;
//import android.support.v7.app.AppCompatActivity;

import androidx.appcompat.app.AppCompatActivity;

import processing.android.PFragment;
import processing.android.CompatUtils;
import processing.core.PApplet;

public class MainActivity extends AppCompatActivity {
  private PApplet sketch;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(CompatUtils.getUniqueViewId());
    setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                     ViewGroup.LayoutParams.MATCH_PARENT));

    sketch = new Sketch();
    PFragment fragment = new PFragment(sketch);
    fragment.setView(frame, this);
  }

  @Override
  public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    if (sketch != null) {
      sketch.onRequestPermissionsResult(
      requestCode, permissions, grantResults);
    }
    super.onRequestPermissionsResult( requestCode, permissions, grantResults);
  }

  @Override
  public void onNewIntent(Intent intent) {
    if (sketch != null) {
      sketch.onNewIntent(intent);
    }
    super.onNewIntent( intent);
  }
}

```

Sketch.java

```auto
package androidstudio.audiotest;

import processing.core.PApplet;

public class Sketch extends PApplet {
  public void settings() {
    size(600, 600);
  }

  public void setup() {
  }

  public void draw() {
    if (mousePressed) {
      ellipse(mouseX, mouseY, 50, 50);
    }
  }
}

```

The above project has nothing to do with audio. It’s just my test project 😁
