GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cannot build Android Mode sketch that uses any native code libraries · Issue #738 · processing/processing-android

Cannot build Android Mode sketch that uses any native code libraries #738

New issue
Copy link
New issue
Copy link
Open
Open
Cannot build Android Mode sketch that uses any native code libraries#738
Copy link
Labels
enhancementneeds confirmation

Description

@ajavamind
ajavamind
opened on Apr 24, 2023
Issue body actions

Description

I am working on converting a Processing OpenCV library to use Android: https://github.com/cansik/opencv-processing
My change requires adding andoid native code references to the library build
However the SDK ignores native android libraries so it is not possible to build an Android apk that requires native code.
Fixing this would open up a new set of Android libraries not currently possible, such as OpenCV, UVC cameras,
Gstreamer +Android, etc.

Expected Behavior

Allow Android Mode libraries to include native code to expand sketch functions on Android devices

Current Behavior

Build folder: C:\Users\andym\AppData\Local\Temp\android8678558073199361583sketch
Exception in thread "Thread-12" java.lang.NullPointerException: Cannot read the array length because "list" is null
at processing.app.Library.wrapFiles(Library.java:427)
at processing.app.Library.getApplicationExports(Library.java:437)
at processing.mode.android.AndroidBuild.copyImportedLibs(AndroidBuild.java:839)
at processing.mode.android.AndroidBuild.createAppModule(AndroidBuild.java:476)
at processing.mode.android.AndroidBuild.createProject(AndroidBuild.java:263)
at processing.mode.android.AndroidBuild.build(AndroidBuild.java:224)
at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:294)
at processing.mode.android.AndroidEditor$17.run(AndroidEditor.java:421)

Steps to Reproduce

For opencv-processing I changed build support for all android platforms
gradlew.bat releaseProcessingLib -PjavacppPlatform=android-arm,android-arm64,android-x86,android-x86_64

Your Environment

  • Processing version: SDK 4.2
  • Operating System and OS version: Windows 11

Possible Causes / Solutions

I believe problem is caused by a line in processing.app.Library:
https://github.com/processing/processing4/blob/main/app/src/processing/app/Library.java

static FilenameFilter libraryFolderFilter = (dir, name) -> {
// skip .DS_Store files, .svn folders, etc
if (name.charAt(0) == '.') return false;
// ha, the sftp library still has one [fry 220121]
if (name.equals("CVS")) return false;
if (name.equals("export.txt")) return false;

File file = new File(dir, name);
if (file.isDirectory()) {
  //noinspection RedundantIfStatement
  if (name.startsWith("macos") ||
      name.startsWith("windows") ||
      name.startsWith("linux")) {
      //name.startsWith("android")) {  // no libraries use this  =========>NOT TRUE UNCOMMENT THIS
    return false;
  }
}
return true;

};

There may be other changes needed, but until I can build my own SDK to test, this is what I know now.

Activity

  1. benfry
    transferred this issue frombenfry/processing4on May 11, 2023
  2. codeanticode
    added
    enhancement
    needs confirmation
    on May 21, 2023
  3. kevinstadler commented on Sep 24, 2023

    @kevinstadler
    kevinstadler
    on Sep 24, 2023
    More actions

    I can confirm that this is a general problem, reproduced by processing/processing-sound#86 (comment) as well as myself (in Android mode 4.5.1/Processing 4.3).

    The issue arises not just when any of the imported libraries uses/bundles a native library, but even just when any of the platform-specific native library directories exists. In the case of the Sound library, I had to remove both the only bundled (Windows) dll, as well as delete all the empty mac-*, linux-* directories to be able to build the sketch in Android mode.

  4. kevinstadler
    added a commit that references this issue on Sep 25, 2023

    Add dist-android target (see #86, processing/processing-android#738)

    f324e22
  5. SableRaf commented on Oct 3, 2023

    @SableRaf
    SableRaf
    on Oct 3, 2023
    More actions

    Hey @codeanticode, could you look into this issue when you have some time? @kevinstadler is making updates to the Processing Sound Library, thanks to a grant from the Processing Foundation. We're targeting an end-of-October release, so your feedback before that would be greatly appreciated 🙏

  6. SammySylvester commented on Nov 21, 2024

    @SammySylvester
    SammySylvester
    on Nov 21, 2024
    More actions

    Hi @kevinstadler!

    I did the same way as you, but with no success!... :(
    Is there some improvement with this library?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.