dlopen failed: cannot locate symbol "_ZN7android10VectorImpl19reservedVectorImpl1Ev" - java

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.

Related

android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false

I have upgrade the Android SDK project 30 to 31 and I also used permission in manifest: . which is required for targeting SDK 28 and above.
In Android 12 I am getting the frequently below crashes on 100% background application.
Also, below Android SDK version 30, its working absolutely fine.
Thanks in Advance !
Non-fatal Exception: java.lang.RuntimeException: Unable to create service com.UploadService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.UploadService
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4949)
at android.app.ActivityThread.access$1900(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2296)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
I have used work manager for startForegroundService in my code, how to use workmanager for startForeground to restrict this crash in Android12 and above
Thanks in advance

java.lang.UnsatisfiedLinkError: dlopen failed: library "libpthread.so.0" not found

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)

How to fix java.lang.SecurityException: Caller lacks required permission com.google.android.things.permission.USE_PERIPHERAL_IO error?

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.

How to add operations into Tensorflow Android build

I am trying to run my Tensorflow model on Android, so I am using the nightly native build in here and following the Android demo, I have been successfully get the Tensorflow Android lib running and loaded up the model with below code.
inferenceInterface = new TensorFlowInferenceInterface(getAssets(), MODEL_FILE);
And the log shows the results are good.
I/TensorFlowInferenceInterface: Successfully loaded TensorFlow native methods (RunStats error may be ignored)
I/TensorFlowInferenceInterface: Model load took 1007ms, TensorFlow version: 1.2.0-rc0
I/TensorFlowInferenceInterface: Successfully loaded model from 'file:///android_asset/model.pb'
However, when I finished feeding all the input nodes
inferenceInterface.feed("input1", new int[]{1, 2, 3}, 1, 3);
inferenceInterface.feed("input2", new int[]{3}, 1);
inferenceInterface.feed("input3", new int[]{4}, 1);
Then call the run method
inferenceInterface.run(new String[]{"output"});
The Tensorflow is broken saying that some kernels are not registered
E/TensorFlowInferenceInterface: Failed to run TensorFlow inference with inputs:[input1, input2, input3], outputs:[output]
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ...jnitest, PID: 16357
java.lang.RuntimeException: Unable to start activity ComponentInfo{...MainActivity}: java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'LessEqual' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: .../LessEqual = LessEqual[T=DT_INT32](.../maximum_iterations, .../LessEqual/y)]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'LessEqual' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: dynamic_seq2seq/decoder/decoder_1/LessEqual = LessEqual[T=DT_INT32](.../maximum_iterations, .../LessEqual/y)]]
at org.tensorflow.Session.run(Native Method)
at org.tensorflow.Session.access$100(Session.java:48)
at org.tensorflow.Session$Runner.runHelper(Session.java:295)
at org.tensorflow.Session$Runner.run(Session.java:245)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:142)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:111)
at ...jnitest.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
.. 9 more
I think the "LessEqual" for int32 should be defined in Tensorflow but just not built along with Tensorflow Android Lib.
So my question is how to include more kernels in the Android lib build or any other way to resolve this, any help will be much appreciated.
I recommending reading this free eBook: Building Mobile Applications with TensorFlow
It has a section on What Ops Are Available on Mobile? (page 33), which explains how to Add the implementation to the build for those op kernels which default to being stripped out for mobile builds.
FYI, the eBook is written by Pete Warden (GitHub, blog), who works at Google and is one of the maintainers of TensorFlow.

Unable to start Chrome CustomTabsIntent in my Android app

I am trying to use Chrome Custom Tabs in my Android application. My MainActivity class extends AppCompatActivity. In onCreate, I invoke startCustomTabs. Below is the code for that:
private void startCustomTab(){
CustomTabsIntent intent = new CustomTabsIntent.Builder().setToolbarColor(getResources().getColor(R.color.colorPrimary)).build();
intent.launchUrl(this, Uri.parse("http://github.com/black-dragon/SaavnExtractor"));
}
As soon as the app launches, it crashes with following the error:
11-16 10:55:38.561 30093-30093/com.nick.saavnextractor
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nick.saavnextractor, PID: 30093
java.lang.NoSuchMethodError: No static method
startActivity(Landroid/app/Activity;Landroid/content/Intent;Landroid/os/Bundle;)V
in class Landroid/support/v4/app/ActivityCompat; or its super classes
(declaration of 'android.support.v4.app.ActivityCompat' appears in
/data/data/com.nick.saavnextractor/files/instant-run/dex/slice-com.android.support-support-compat-25.0.0_15c83dd4ec129d2d74bfda2e34f6aeeb93d83fa1-classes.dex)
at android.support.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:262)
at com.nick.saavnextractor.MainActivity.startCustomTab(MainActivity.java:325)
at com.nick.saavnextractor.MainActivity.onCreate(MainActivity.java:111)
at android.app.Activity.performCreate(Activity.java:6311)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
at android.app.ActivityThread.access$900(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5507)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Note: If I execute the same code with the same methods in a new app, the Custom Tabs launch fine.
Okay, so here is the resolution. I was using build tools version 25.0.0 but my SDK platform was 24.
Update the build tools, platform tools & SDK to same version and then you won't face this issue.
Along with #Nick's answer, I also had to update the Facebook SDK version and the crash stopped happening.
You need to add Customtabs dependency in your build.gradle file.
implementation 'com.android.support:customtabs:28.0.0'

Categories

Resources