android studio - gpio

I need help!!

How can I use GPIO, UART in Android Studio. I can not find any help to start with.

I use rockpi4 B, Android 7/9

Thank you

You mean you need to use gpio inside apk?

Yes, GPIO and UART.

Here is an example:

But it does not work on android 7.

Running shows me this message:
“Detected problems with app native libraries (please consult log for detail): unauthorized access to” "

Find the URAT nodes you need, such as /dev/tty4, using Java’s IO API, Notice permissions!

Gpio with shell command:
According to the kernel/include/dt-bindings/pinctrl/rockchip.h
Each gpio group had 32 gpios.

# GPIO0_A5
echo 5 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio5/direction
echo 1 > /sys/class/gpio/gpio5/value
# GPIO1_A5
echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction
echo 1 > /sys/class/gpio/gpio36/value

You can read and write using jni, You also need to be aware of permissions.

How can I change the permissions?

I’m using jniLibs from Radxa’s own example for android 4. But I get the error, which I put in the previous post. Attached image so you can see my code.

Sorry, but I using Radxa’s example does not work. Can you give me an example for android 7?

I sent you a link to my project.

I used the other example with jni_code. But it does not work on Android 7.

Show the message: “gpio ocupied”

Please, you can help me more. I do not know how to continue.