Android Question things periferial manager error

kalarius

Active Member
Licensed User
Longtime User
i have copy the example of the led that on and off with the button

upload_2018-5-6_18-39-24.png

this is a photo of my configuration
at line 29 stop with error
i have update to jdk 1.8.172
api 27
I have add the line to manifest
when i down load the example to raspberry show me the error
at line pm.Initialize

things lib version 1.01
core vesrsion 8.0

on raspberry os version 8.1.0 api level 27

please advice me
Kalarakis
 

kalarius

Active Member
Licensed User
Longtime User
here is my code (the exaple of the led)
Sub Process_Globals

Private pm As PeripheralManager
Private pin4 As Gpio 'led
Private pin17 As Gpio 'button
End Sub

Sub Globals
Private ToggleButton1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
pm.Initialize
Log(pm.GpioList)
pin4 = pm.OpenGpio("BCM4")
pin4.Direction = pin4.DIRECTION_OUT_INITIALLY_LOW
pin17 = pm.OpenGpio("BCM17")
pin17.Direction = pin17.DIRECTION_IN
pin17.AddListener("pin17")
End If
Activity.LoadLayout("1")
Do While True
pin4.Value = True 'turn on or off the led
Sleep(1000)
pin4.Value=False

Loop

End Sub

Sub Pin17_StateChanged (Value As Boolean)
Dim clr As Int
If Value Then clr = 0xFF54EF72 Else clr = 0xFFC52D56
Activity.Color = clr
End Sub

Sub ToggleButton1_CheckedChange(Checked As Boolean)
pin4.Value = Checked 'turn on or off the led
Sleep(1000)

End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ToggleButton1_Click

End Sub
[\quote]

and the error at line 30 ( pm.Initialize)

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 30 (Main)
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 java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at gg.example.main.afterFirstLayout(main.java:104)
at gg.example.main.access$000(main.java:17)
at gg.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)
** Activity (main) Resume **


things version 1.1
B4A ver 8
api 27

raspberry ver 8.1.0 userdebug
api 27

Kalarakis
 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
with or without this
#AdditionalJar: androidthings, ReferenceOnly

I get the same error message
 
Upvote 0

udg

Expert
Licensed User
Longtime User
:)
 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
I download the thing version and now shows 1.10
I download the android-thing to new version and now it is 8.1.0 api level 27

BUT the proble still exist
this is the program
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Pm As PeripheralManager
End Sub
#AdditionalJar: androidthings, ReferenceOnly
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")

Dim a As Boolean
Pm.Initialize

End Sub
[\quote]

******** the program does not do anything I try to start with android-things
when execute the line
Pm.Initialize

I got the error
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/things/pio/PeripheralManager;
at anywheresoftware.b4a.objects.PeripheralManagerWrapper.Initialize(PeripheralManagerWrapper.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.things.pio.PeripheralManager" on path: DexPathList[[zip file "/data/app/b4a.example-hTmGp1fPE_RaA_NeQp5VBw==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-hTmGp1fPE_RaA_NeQp5VBw==/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **



this says that does not find some files.
but i does not understand it



 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
Problem Solved

I had forgot to add the
AddPermission(com.google.android.things.permission.USE_PERIPHERAL_IO)
AddApplicationText(<uses-library android:name="com.google.android.things"/>)

at the manifest editor

( the update to raspberry ver 8.1.0 and thing lib to ver 1.1 also needed)

thank
 
Upvote 0
Top