This question is regarding a fatal exception error message that occurs when using Blepdroid (a Bluetooth low energy library) with later versions of Processing 3. My tests suggest their may be a bug or unlisted change in Processing. I would value an opinion on the source of the problem before submitting it as a bug to the Processing developers. The error message is listed below.
FATAL EXCEPTION: Animation Thread
Process: processing.test.test2, PID: 17735
java.lang.NoSuchMethodError: No virtual method getFragmentManager()Landroid/app/FragmentManager; in class Lprocessing/core/PApplet; or its super classes (declaration of āprocessing.core.PAppletā appears in /data/app/processing.test.test2-1/base.apk)
at blepdroid.Blepdroid.<init>(Blepdroid.java:293)
at processing.test.test2.Test2.setup(Test2.java:88)
at processing.core.PApplet.handleDraw(PApplet.java:1801)
at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:471)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:503)
Iāve written many programs using Blepdroid and Processing version 3.2.3. These have worked perfectly for the last 18 months, successfully accessing Blepdroid and presumably the fragment manager method that Blepdroid calls. With Processing versions 3.3.7 and 3.4 my same programs plus Blepdroid still build successfully but when run they give the fatal exception error message shown above:
My programs also continue to run properly with newly installed versions of the SDK for 3.2.3 provided I include my old Processing folder with its SDK folder. If I donāt include the folder I get a message saying that Android no longer supports this version of Processing.
Blepdroid hasnāt changed in the last year and I have been using the same copy of Bepdroid throughout that time. If Blepdroid has successfully called for FragmentManager in earlier versions then it must have been available in those earlier versions. However, I couldnāt find anything in the changes notes for Processing 3 that says access to the FragmentManager method has been changed?
Below is a simplified example of code that uses Blepdroid and works without error on Processing version 3.2.3 but fails with the error message above on Processing versions 3.3.7 and 3.4.
import blepdroid.*;
import blepdroid.BlepdroidDevice;
import android.os.Bundle;
import android.content.Context;
import android.app.Activity;
import java.util.UUID;
Blepdroid blepdroid;
Activity activity;
Context context;
void setup(){
blepdroid = new Blepdroid(this);
size(480, 890);
}
void draw(){
background(255,0,0);
fill(0);
}
Manifest for Processing 3.2.3
<?xml version="1.0" encoding="UTF-8"?>
-<manifest package="" android:versionName="1.0" android:versionCode="1"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:targetSdkVersion="26" android:minSdkVersion="15"/>
-<application android:label="" android:icon="@drawable/icon">
<service android:name="blepdroid.BluetoothLeService"/>
-<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
-<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
References
Blepdroid source code, downloadable code and a statement of the issue https://github.com/joshuajnoble/blepdroid
Another discussions of this issue
Thanks for any advice, Peter