Android Question [Things] PeripheralManager Error - java.lang.RuntimeException: Stub!

Adie

Member
Licensed User
Longtime User
Ok, I upgraded to the latest Android Things and now also get the error.

Background:
1. SDK 25
2. All modules up to date.
3. Original app worked 100% on older Things and B4A 7.
4. B4A 8

The code supplied is just two tests:
1. Define pm
2. Init pm - where the app crash
3. I removed the line:
B4X:
    File.WriteString(File.DirRootExternal, "Limits.txt", "100~200" )
because I could not get write access to external

What I noted:
1. If I remember correctly I HAD to put this line
B4X:
  AddApplicationText(<uses-library android:name="com.google.android.things"/>)
in the manifest editor or the app will not execute on the Pi.
Now it does not matter.

2. I was under the impression the marked line in the 'AndroidManifest.xml' will allow write access to the external storage. does not seems to do anything.

3. adding
B4X:
 <uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />
as per Google to the manifest does nothing.

Sample of final manifest.
B4X:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="b4a.example"
    android:versionCode="1"
    android:versionName=""
    android:installLocation="internalOnly">
  
    <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="24"/>
    <supports-screens android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
====>>    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <application
        android:icon="@drawable/icon"
        android:label="B4A Example">
      
        <uses-library android:name="com.google.android.things"/>
        <activity
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".main"
            android:label="B4A Example"
            android:screenOrientation="unspecified">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
          
        </activity>
        <service android:name=".starter">
        </service>
        <receiver android:name=".starter$starter_BR">
        </receiver>
    </application>
</manifest>

Any help will be appreciated.

Adie
 

Attachments

  • Things error.zip
    1.9 KB · Views: 296

Adie

Member
Licensed User
Longtime User
hi
This is it.

B4X:
Logger connected to: 192.168.1.14:5555
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 32)
pm.Initialize
java.lang.RuntimeException: Stub!
    at com.google.android.things.pio.PeripheralManagerService.<init>(PeripheralManagerService.java:10)
    at anywheresoftware.b4a.objects.PeripheralManager.Initialize(PeripheralManager.java:29)
    at b4a.example.main._activity_create(main.java:374)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
 
Upvote 0

Adie

Member
Licensed User
Longtime User
THANK YOU!!!! all working again.

The system is used in a foundry to remotely monitor the mass in the ladle. (Radio modems) The last few days was a nightmare for them as they had to estimate the mass and the mold was not filled correctly a few times.

The power supply of the Pi packed up and damaged the SD card.

thanks again.
Adie
 
Upvote 0
Top