Im trying to make an app for serial comminucation with android
im using rxtx library
Unfortunately i got a problem in my project
Thats my Logcat error :
java.lang.UnsatisfiedLinkError: dlopen failed: library "libpthread.so.0" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1669)
at gnu.io.LibraryLoader.loadRxtxNative(LibraryLoader.java:32)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:118)
at gnu.io.CommPortIdentifier.getPortIdentifier(Unknown Source:0)
at com.example.pooya.myapplication.Connection.open(Connection.java:145)
at com.example.pooya.myapplication.MainActivity$1.onClick(MainActivity.java:37)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
i added the libpthread.so.0 file to my jnilibs (all subfolders) but the result is same.
please give me a hint to solve this problem
There is no libpthread.so on Android, all threading functions are handled by libc itself. It seems the RxTx library does not support the Android platform.
You can try porting it yourself or use another solution:
Android Things API
Android USB Host API
RxTx Android port (warning: last update 2011)
android-serialport-api (warning: last update 2011)
usb-serial-for-android (last update 2016)
Related
I need help, cause I'm stucked for 2 days from now and i can't find anything.
I bought device: Kcosit V720 on aliexpress and they send me library with it, but it's so hard to get it work correctly.
While I was trying to load library, i had to download libcamera_client.so, because libbarcodereader.so needed it, so i don't know if it is compatible, but now, I'm receiving another error. Any ideas how to fix it ?:
2020-06-19 09:29:33.056 7239-7239/com.lukas.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lukas.myapplication, PID: 7239
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10VectorImpl19reservedVectorImpl1Ev" referenced by "/data/app/com.lukas.myapplication-1/lib/arm/libbarcodereader.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1530)
at com.lukas.myapplication.MainActivity.<clinit>(MainActivity.java:12)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2616)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
You are most likely missing another .so file. Ensure that all .so files are in the same directory.
The following may help to identify referenced .so files:
https://unix.stackexchange.com/questions/120015/how-to-find-out-the-dynamic-libraries-executables-loads-when-run
Update:
I'm not aware of any android API for this type of hardware. According to https://kcosit.com/kcosit-v720-p1496437.html your device contains most likely a OEM version of the SE4710 barcode scanner, manufactured by Motorola. It seems that there exists an SDK from Motorola but I could only find the corresponding documenation. It is most likely used as base for SDKs provided by OEM licensors. One of such an SDK is available here: https://developer.zebra.com/community/tools
Maybe you are lucky and you can use this SDK also for your device. If it should
also be compatible with your device you would of course also need to check license of the SDK - I haven't found any info yet. Maybe you are able to find a source for the original SDK from Motorolla or an other SDK from an OEM licensor.
I'm trying to activate a python file (placed on my desktop) from android studio:
String command = "python /home/roye/Desktop/check.py";
Process p = Runtime.getRuntime().exec(command );
DataOutputStream outputStream = new DataOutputStream(p.getOutputStream());
it gives me this error:
W/System.err: java.io.IOException: Cannot run program "python": error=13, Permission denied
W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050)
at java.lang.Runtime.exec(Runtime.java:695)
W/System.err: at java.lang.Runtime.exec(Runtime.java:525)
at java.lang.Runtime.exec(Runtime.java:422)
at com.example.myapplication.MainActivity$1.onClick(MainActivity.java:42)
at android.view.View.performClick(View.java:6608)
at android.view.View.performClickInternal(View.java:6585)
W/System.err: at android.view.View.access$3100(View.java:785)
at android.view.View$PerformClick.run(View.java:25919)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
W/System.err: Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
at java.lang.ProcessImpl.start(ProcessImpl.java:132)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 15 more
I can really use some help, thank you!
I think the way, you run Python in android is wrong. there are some ways you can use it.
Chaquopy
a plugin for Android Studio’s Gradle-based build system.Chaquopy enables you to freely intermix Java and Python in your app, using whichever language is best for your needs
Kivy
a cross-platform OpenGL-based user interface toolkit. You can run Kivy applications on Android, on (more or less) any device with OpenGL ES 2.0 (Android 2.2 minimum).Kivy APKs are normal Android apps that you can distribute like any other, including on stores like the Play store
Pyqtdeploy
a tool for deploying PyQt applications. It supports deployment to desktop platforms (Linux, Windows and OS X) and to mobile platforms (iOS and Android).
Termux
an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically
for details, you can see this wiki chart
I am trying to integrate Symmetric-Android 3.10.2 in my Android application. It is showing
java.lang.NoClassDefFoundError:
org.jumpmind.symmetric.io.stage.StagingManager$1
Even the class exists in jarfile
I have upgraded my API level from 22 to 26 after reading article from
https://sourceforge.net/p/symmetricds/discussion/1354726/thread/f965364c00/
but the issue remains
java.lang.NoClassDefFoundError:
org.jumpmind.symmetric.io.stage.StagingManager$1
at org.jumpmind.symmetric.io.stage.StagingManager.(StagingManager.java:288)
at org.jumpmind.symmetric.android.AndroidSymmetricEngine.createStagingManager(AndroidSymmetricEngine.java:108)
at org.jumpmind.symmetric.AbstractSymmetricEngine.init(AbstractSymmetricEngine.java:348)
at org.jumpmind.symmetric.android.AndroidSymmetricEngine.(AndroidSymmetricEngine.java:84)
at org.jumpmind.symmetric.android.SymmetricService.onStartCommand(SymmetricService.java:88)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3944)
at android.app.ActivityThread.access$2300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1833)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
It sounds like your issue may not be related to SymmetricDS, but instead how your classpath is configured in this Android project. There are several solutions in this thread that might help
I'm attempting to use the code here for encryption https://commons.apache.org/proper/commons-crypto/xref-test/org/apache/commons/crypto/examples/CipherByteArrayExample.html. I copied the code word-for-word and I am not sure why I'm getting this exception as I can't find much on the issue. The only part that I changed was "StandardCharsets.UTF_8" to the String "UTF-8." I am also not interested in using Bouncy Castle or the java JCE as alternatives but am open to other libraries that use AES/DES in CBC/ECB modes (I am aware of the dangers of DES/ECB so no need for the lecture). Thank you.
EDIT:
Stack trace (Note that line 62 of Crypto.java is "CryptoCipher encipher=Utils.getCipherInstance(transform, properties) ):
W/System.err: java.io.IOException: java.security.GeneralSecurityException: CryptoCipher {org.apache.commons.crypto.cipher.OpenSslCipher} is not available or transformation AES/CBC/PKCS5Padding is not supported.
at org.apache.commons.crypto.utils.Utils.getCipherInstance(Utils.java:130)
at com.example.me.cryptotest.Crypto.test(Crypto.java:62)
at com.example.me.cryptotest.MainActivity.onCreate(MainActivity.java:43)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
W/System.err:
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
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.security.GeneralSecurityException: CryptoCipher {org.apache.commons.crypto.cipher.OpenSslCipher} is not available or transformation AES/CBC/PKCS5Padding is not supported.
at org.apache.commons.crypto.cipher.CryptoCipherFactory.getCryptoCipher(CryptoCipherFactory.java:176)
at org.apache.commons.crypto.utils.Utils.getCipherInstance(Utils.java:128)
... 15 more
W/System.err: Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.apache.commons.crypto.utils.ReflectionUtils.newInstance(ReflectionUtils.java:90)
at org.apache.commons.crypto.cipher.CryptoCipherFactory.getCryptoCipher(CryptoCipherFactory.java:160)
... 16 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
W/System.err:
at org.apache.commons.crypto.utils.ReflectionUtils.newInstance(ReflectionUtils.java:88)
... 17 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: no native library is found for os.name=Linux and os.arch=x86
at org.apache.commons.crypto.cipher.OpenSslCipher.<init>(OpenSslCipher.java:59)
... 20 more
Caused by: java.lang.RuntimeException: no native library is found for os.name=Linux and os.arch=x86
at org.apache.commons.crypto.NativeCodeLoader.findNativeLibrary(NativeCodeLoader.java:120)
at org.apache.commons.crypto.NativeCodeLoader.loadLibrary(NativeCodeLoader.java:62)
at org.apache.commons.crypto.NativeCodeLoader.<clinit>(NativeCodeLoader.java:50)
at org.apache.commons.crypto.NativeCodeLoader.isNativeCodeLoaded(NativeCodeLoader.java:261)
at org.apache.commons.crypto.Crypto.isNativeCodeLoaded(Crypto.java:84)
W/System.err: at org.apache.commons.crypto.cipher.OpenSsl.<clinit>(OpenSsl.java:94)
at org.apache.commons.crypto.cipher.OpenSsl.getLoadingFailureReason(OpenSsl.java:114)
at org.apache.commons.crypto.cipher.OpenSslCipher.<init>(OpenSslCipher.java:57)
... 20 more
I see your problem here:
java.lang.RuntimeException: no native library is found for os.name=Linux and os.arch=x86
Looks like you are not using Oracle JVM. Possible your JVM is reporting different os.arch string then standard Oracle JVM, so you need to copy the native library from possibly linux/i386 to linux/x86 (wild guess). Fire a google search on this error no native library is found for os.name=Linux and os.arch=x86, and playaround with your OS & JVM to help your runtime find the required native library(s).
Update:
If you look at the `README.md' of the project on github. You will notice this:
Portable across various operating systems (currently only Linux/MacOSX/Windows); Apache Commons Crypto loads the library according to your machine environment (it checks system properties, os.name and os.arch).
And this is the dll structure they have in the code,
so you can override your System property 'os.arch' to load the native library as per your OS:
System.setProperty("os.arch", "#folder")
Just for reference, I am running the code in Windows 10 with Oracle JDK8, so my derived path is coming to /org/apache/commons/crypto/native/Windows/x86_64/commons-crypto.dll
Hope this will provide you more help in resolving the issue.
I am trying to get an Android Things project to build and run on a Raspberry Pi 3. The files are found here. I am connected to my Raspberry Pi 3 via Ethernet. I plugged the ethernet cable directly from my laptop to the rPi and used Internet Sharing. I then used adb connect to connect to the device and it successfully connects.
I am running:
Android Studio 3.1.2
Build #AI-173.4720617, built on April 13, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
Changes were made to Android Studio so I had to change some code around. I downloaded the files and updated the PeripheralManagerService to PeripheralManager instead.
PeripheralManager pioService = PeripheralManager.getInstance();
When I click the Run button, I get the following error (please keep in mind that I already added the following permission to Android Manifest file above the application section):
<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO"/>
Please help me with figure out what I am still missing. Thanks!
06-08 01:43:28.746 3598-3598/? I/zygote: Late-enabling -Xcheck:jni 06-08 01:43:28.993 3598-3598/apps.hackstermia.buttonthings I/MainActivity: Starting ButtonActivity
06-08 01:43:29.013 3598-3598/apps.hackstermia.buttonthings I/MainActivity: Configuring GPIO pins
06-08 01:43:29.017 3598-3598/apps.hackstermia.buttonthings D/AndroidRuntime: Shutting down VM
06-08 01:43:29.028 3598-3598/apps.hackstermia.buttonthings E/AndroidRuntime: FATAL EXCEPTION: main
Process: apps.hackstermia.buttonthings, PID: 3598
java.lang.RuntimeException: Unable to start activity ComponentInfo{apps.hackstermia.buttonthings/apps.hackstermia.buttonthings.MainActivity}: java.lang.SecurityException: Caller lacks required permission com.google.android.things.permission.USE_PERIPHERAL_IO
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
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.SecurityException: Caller lacks required permission com.google.android.things.permission.USE_PERIPHERAL_IO
at android.os.Parcel.readException(Parcel.java:2005)
at android.os.Parcel.readException(Parcel.java:1951)
at com.google.android.things.pio.IPeripheralManagerClient$Stub$Proxy.GetGpioClient(IPeripheralManagerClient.java:759)
at com.google.android.things.pio.GpioImpl.<init>(GpioImpl.java:50)
at com.google.android.things.pio.PeripheralManager.openGpio(PeripheralManager.java:197)
at apps.hackstermia.buttonthings.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:7010)
at android.app.Activity.performCreate(Activity.java:7001)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
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)
06-08 01:43:29.047 3598-3598/apps.hackstermia.buttonthings I/Process: Sending signal. PID: 3598 SIG: 9
At first, following lines should be included by AndroidManifest just before application tag
<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />
<uses-permission android:name="com.google.android.things.permission.MANAGE_INPUT_DRIVERS" />
Then, if you install application via adb, you should install <APK> with -g option as follow as recomended by #Devunwired here
adb install -g <APK>
friends~!
I had the same problem with my Android Studio 3.1.3 and RaspberryPi 3 and AndroidThings. This platform was killing my "blink" app, because I had a lacks permission of "[..] USE_PERIPHERAL_IO".
For my problem, the solution was adding this sentence:
<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO"/>
<uses-permission android:name="com.google.android.things.permission.MANAGE_INPUT_DRIVERS" />
to my Android Manifest file.
Thanks, anyone for help :))
Thanks for your input everyone.
I found out that the permission in the manifest file needs to be a direct child, or outside of the application
I had the same issue. Tried different approaches as mentioned above. What really works for me
1. update your android studio to the latest version. Mine was 3.0.1. After upgrade, it is 3.1.3
2. update the os version of android things to the latest. It was 0.6. After upgrade, it is 1.0.1.
3. Set those permission in android manifest
<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO"/>
<uses-permission android:name="com.google.android.things.permission.MANAGE_INPUT_DRIVERS" />
hope those steps will make your android things working
Depending on the version of Android Studio, the prisons are applied and granted on upgrades and installs or only on installs (on older versions)
Rebooting the device should fix it, uninstalling and reinstalling the app should also fix it.