Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

In this Discussion

Android PDE - Create and run sketches on an Android device



  • Hi, Is there a way to load external pdes to load as a library to the sketch? When I load the pde by using add to library button, it is putting the pde inside data folder..

    So is there a way to do that?

  • @vikramarka

    If this is to get a sketch created elsewhere (on a PC/Mac) into APDE, just copy your sketch folder to APDE's 'skecthes' folder and you can then just load it like any other sketch.

  • @hudson_m4000: This sounds very strange. I am able to build a sketch that has a tab with more than 1000 lines of code, along with numerous additional classes, functions, etc. Editing that tab is another story... but I don't experience the issues that you describe. This may be a device specific issue. The problem may occur with a file that is even larger, perhaps 5000 lines of code, but I don't think it would be possible to edit such a file on any form of Android device due to sluggishness.

  • APDE version 0.3.2 is just around the corner. This release will include a fix for devices running Android 5.0 Lollipop.

    I am starting a preview channel for those that are interested in getting new features early in exchange for potentially buggy software. The preview APK is distributed through Google Play's alpha testing service. To receive the preview updates, please join APDE's new Google+ community and follow the link provided in the sticky post at the top. The preview channel will probably get updated whenever I complete a feature or set of features - this may be between once every few days and once every couple of weeks. Preview updates will not be tested thoroughly, although your use of the updates and feedback will help to make APDE all together more stable.

    If you want the fix for Android 5.0 now, then please join the preview channel.

  • If I want to use an external library (like apiwidgets for sound), how do I do that with APDE?

  • @ChuiGum: First, you must download the library ZIP file.

    From the APDE overflow menu, select "Tools" and "Import Library", then select "Manage Libraries". From the library manager overflow menu, select "Install Compressed Library". You will be prompted to select the library ZIP file that you downloaded earlier.

    After the library is finished installing, you can automatically add the imports from the Import Library menu (this does nothing more than add the imports to the top of the sketch).

  • Thanks for the quick reply. I tried this with the APWidgets r44 zip. I downloaded the zip from my device and then went to "Install Compressed Library", selected it from my downloads, and it then said "Unfortunately, APDE has stopped". I tried it again over and over and the same message pops up after selecting the zip. Did I do something wrong?

  • @ChuiGum: Sorry for the delay in my response... I have created a new guide for library installation, both with the installer and manually. Seeing as you are unable to use the installer, please try the manual method. If this still fails, then please try to provide additional information... this has been a persistent issue since I first added library support.

  • Can I upload the same .apk as I did to Google Play to the Amazon App Store? It was failing, so I was wondering if it was Processing itself or something else?

  • @ChuiGum: Uploading the app to the Amazon App Store should not make a difference for Google Play. As far as I am aware, both of these services allow apps to be dually hosted on each other.

    I tested uploading an APK built and signed with APDE to a new (temporary) Google Play application and it produced no errors.

    What error message do you receive? If you are updating an existing application, did you sign it with the same keystore as you used the first time? An upload failure should have nothing to do with Processing and/or APDE. Most likely, you did something wrong with the manifest file or with signing.

  • calsign. I'm having a lot of trouble trying to load any files. I've tried to use the "Add file" button in the sketch properties. The button seems ineffective as the file I attempted to load does not actually appear in my sketch folder (when using an external viewer). If I manually add the desired file into the sketch folder, the sketch cannot find the file. I am attempting to load these files with sketchPath("");. Could you also explain what this path leads to: /data/data/processing.test.soundtest/files

  • Is there a limit to the number of JPG images I can load using the APDE Processing app for Android?

    I have been working on a project that requires about 40 small jpg images at a size of about 30 KB each. The problem I am encountering is a java.lang.OutOfMemoryError. I have researched this issue for Android and all forums seem to indicate that in theory as many images as possible can be compiled into an app as long as they fit within the constraints to a tablet's memory. However, in my case the size of my image files does't seem to be what is causing the error. I have noticed that with APDE there seems to be a limitation of 30 images that can be loaded in a processing sketch. Even when I have compressed my image sizes down to a very tiny size (well below memory constraints). Assuming that my hypothesis is correct and I am observing a 30 image limit, is this a built in limitation of APDE or is it some sort of software bug?

    Any help with this issue would be greatly appreciated, even just knowing if this is an intentional limitation. Thanks!

  • @olta8: First, I apologize for not responding for so long...

    "Add file" should add files to the data folder, which is inside the sketch folder. Do the files appear in the data folder instead?

    The /data/data/... path is the location of the sketch's internal storage directory after it is installed (where files saved in the sketch are stored), which is likely inaccessible to you unless your device is rooted. All of the files in the sketch data folder should be copied into the assets folder after installation, which is located at the same level as the "files" folder.

    If this doesn't seem to be working properly or is confusing, I can provide further explanation/debugging.

  • @RadioHealer: As far as I know, the only limitation for the number of images loaded is the memory available to the sketch. Note that this limitation is a limitation of Android, not APDE, and that if another such limitation exists, it is in Android Mode, not APDE.

    You might have a memory leak somewhere in your code, perhaps where the same image is loaded several times, multiplying the sketch's memory consumption. There is a pretty good chance that this is happening because, as you say, it doesn't sound like you're using nearly enough memory to trigger an OutOfMemoryError.

    Alternatively - do you really need all forty images loaded at the same time? If possible, you could dynamically load/unload them to only keep a minimal number in memory at a time.

    If all else fails, you can try enabling android:largeHeap in the AndroidManifest.xml file, which is located in the sketch folder.

  • @RadioHealer I had a similar issue and it was because even though you have jpg files, you lose the compression benefits when importing .. the file becomes a PImage which is essentially uses the same memory (or possible slightly more?) than a regular bitmap image. I soon ran out of available memory which as Calsign says is governed by Android ... you may be lucky and have 48MB but old phones etc could well be half that. Using a largeHeap will help but is till prone to OutOfMemory errors if you're not careful!

  • Thank you calsign and hudson_m4000! It is helpful to understand that PImage uses the same memory as a regular bitmap image. This would explain why my image compression is not making a difference. I checked my code for memory leaks, and everything checks out okay, it seems like the way PImage works is the reason for the OutOFMemoryError. It isn't necessary that all images are loaded at once, so I will take the next step and modify my sketch so that my app will dynamically load/unload images.

    Thank you calsign for your work on APDE. APDE is incredibly useful and easy to use!!! Thank you.

  • @calsign, many thanks for an invaluable tool. Processing offers so much of the boilerplate and for an Android solution, being able to write pde and include as a module of an application makes my life a lot easier.

    I have one request-for-assistance and one question:


    I want to export the APDE-built application as an Eclipse project. The console reports that all is good, but I cannot see any bin/ directory or files created despite what looks like an otherwise good build target: Initializing build sequence... Target: export Deleted old export folder Pre-processing... Writing AndroidManifest.xml... Writing ANT build files... Writing resources... Copying Processing libraries... Copying contributed libaries... Exported to /storage/emulated/0/Android/data/com.calsignlabs.apde/files/android_fft_minim/bin/export


    The applications I generate will generally become apklib modules back in Eclipse land. Is there a setting in APDE to generate an Android library as opposed to an APK ?

  • Ok, wrt [assistance]

    I managed to load them. My 14.04 mtpfs did not have the privilege to see the dir. Once browsing on the device itself, the files were found.

  • edited May 2016

    I have a sketch with shapes using Pshape. But the shapes will not be displayed: I actually wrote the sketch on a PC and now wanted it to run on a tablet. Besides that the sketch is working very well. Is this a known bug concering PShape?

  • Has anyone used some computer vision library like openCV or boofcv with APDE, any examples?

  • Weird bugs: I managed to copy a bunch of externally made sketches into the folder apde is using as its sketchbook (which doesn't seem to be affected by the setting to change it) but now, while I can see them clearly next to the pre-existing sketch in File Manager, apde is just not showing them!

  • There is a new forum now

  • Oh okay! Um. Where? Thanks.

Sign In or Register to comment.