I'm currently working with Aldebaran-Robotics' NAO (v3.3) and I was wondering if I can use the jNAOqi-SDK within Android to control the robot from a phone or tablet.
Using the SDK with basic java in Eclipse was pretty simple as described in this tutorial, so I tried to do this in ADT Eclipse. I imported the *.jar-file and placed the precompiled libjnaoqi.so from the package in libs/armeabi and libs/armeabi-v7a, but calling System.loadLibrary("jnaoqi") or System.loadLibrary("<jnaoqi>") resulted in the following error at runtime:
I/dalvikvm(2019): Unable to dlopen(/data/data/com.example.hellonao/lib/libjnaoqi.so): Cannot load library: link_image[1995]: failed to link libjnaoqi.so
I checked the filesystem, but the file was in the lib folder as expected, so I guess it has to be a problem with the library itself.
It's just a shot in the dark but do I have to recompile the library using ndk and naoqi?
I quickly abandoned my project but Aldebaran was busy in the meantime. I recently found a thread about it in the Aldebaran community (login required), where two employees (Nicolas Rigaud and Erwan Pinault) mention upcoming Android support.
nrigaud:
there will be a better Java SDK on our next software version. Meanwhile, it's true that it's not that easy to do Java on the robot
epinault:
In the next SDK you will have library (jar/so) for android
Related
A gentleman was kind enough to pass me a link of a repository with bluetooth functionality. I imported it from GitHub. I tried then copying it, but noticed eventually that Android Studio built and organized a different style of directory than that from the github repository. So I deleted the entire directory, and just pasted that of the github depository in.
However, the repository version suffers from the fact that the classes say "Java file outside of source root". Moreover, when I tried to import it, it generates the error "The project is using an incompatible version (AGP 7.3.0) of the Android Gradle plugin. Latest supported version is AGP 7.2.2". I read online I could just update Android Studio instead of downgrade Gradle. When I do the most recent update (I think), Android Studio tells me that the project doesn't use the Gradle build system.
Also, AndroidManifest.xml says that it can't resolve certain activities, such as "MainActivity", which does exist. I think AndroidManifest.xml is in the root folder as it should be.
Any idea what is wrong with my program? At this point, this is just copy-and-pasted from the github Bluetooth Chat program. Is that outdated, etc?
I have spent hours trying to troubleshoot this. Perhaps there is someone with some experience in it.
I will try to explain my problem.
For two days I have been struggling with errors popping up during the process of building an android application.
I need to make an Android project for the Structure Core device, the manufacturer has put on his website a sample program and environment for which the scanner works, which I have uploaded to my cloud:
https://1drv.ms/u/s!AoHG6AtGqj2_g0eyFYMyh2uUNJUQ?e=aBpG1T
It's all about the build process itself which will allow me to open this project in Android Studio.
I do everything as in the instructions, but after executing the instructions, I get such an error and I have no idea what caused it. After installing ndk-bundle via SDK Manager, I had an ndk folder in AppData / Local / Android / Sdk, and the console asked for the ndk-bundle folder, so I just changed the name, I don't know if it was a problem, although I didn't find another solution.
At the moment I am working on a Windows generated environment and works good but i have to get an acces to Android App.
Ask if you could try to compile it on your own and possibly send me your ndk-bundle file or tell me what's wrong here.
Stucture Core notes that it is best to use ndk 21.01 and jdk11.
I tried to do this with a lot variation of java version.
This question is NOT ABOUT how to debug the javascript-land of an React-Native app. It is about how to debug native libraries (means: JAVA-Code in this case) in the node_modules-folder.
While it is very easy for me to debug native iOS-parts of RN-Applications with XCode, i stumbled upon various issues with Android Studio...
The main thing is, that the node_modules-Folder is not present after importing the project into Studio, why it is not possible to setup breakpoints to debug thru.
Versions:
Android Studio 2.2.2 (most recent version currently)
react-native 0.38.0 (latest version also)
gradle 1.3.1 (preconfigured from react-native init)
also tried with upgrade to gradle 2.2.2
Android SDKs and -Build Tools from up to Version 23 installed including NDK
How I did it / Steps to reproduce
1. create new react native project:
react-native init debugTest
2. install third party library with native code that you want to debug natively
cd debugTest &&
react-native install react-native-sqlite-storage
3. ensure that everything would work on android side:
launch GenyMotion
launch an AVD
run the application with this command in terminal:
react-native run-android
(this will open up packager and everything else that is needed to transfer the js-bundle).
If one wants to omit this step, it is necessary to start the packager manually:
node node_modules/react-native/local-cli/cli.js start
4. launch Android Studio
with the upcoming starter dialog, choose "Import Project"
select the directory "android" of your project and click on "import"
(these steps are taken from official RN-documentation):
If you want to use Android Studio to work on native code, from the
Welcome screen of Android Studio choose "Import project" and select
the android folder of your app.
5. Android Studio asks to update gradle version from pre-configured 1.3.2 to 2.2.2. I have first denied it for the whole workflow, later on i tried it out (both did not differ significantly for me)
6. One have to deactivate Instant Run due to this issue
7. Click on "Run" or "Debug" in the Toolbar of Android Studio
So far everything works fine. I was able to set a breakpoint in MainApplication.java::onCreate and could step into this method then.
But here are the questions:
The node_modules-Folder isn't present in Android Studio and can't be debugged this way. How to achieve that?
Debugging the onCreate-Method and going further down into the Java-Stack, very offen it happened that the "Sourcecode does not match the byte code".
The debugger was hanging somewhere else in comments of source code but not on exactly that line, which was selected to execute.
Android SDKs:
I have installed all SDKs and build tools and NDK and everything else since version 23:
TL;DR:
How to debug native libraries that are present in node_modules-Folder of an react native application with Android Studio, because they are not visible in AS thus no breakpoint could be passed?
UPDATE
Finally i've found out the root cause. For me it wasn't working due to the fact, that the library i wanted to debug, wasn't shown in Android Studio. But this was a mistake by myself because the library wasn't setup correctly, why gradle wasn't able to take notice of it.
So, this question can be used like a blog post how to do it right (and will be sufficient if the 3rd party library works out of the box with "rnpm-link" or "react-native link") [which wasn't the case here in my example]
Have you done rnpm link or react-native link ? Once you do that, there will be additional modules along with the app module, something like this.
You can look at all the java code in the native module and put breakdpoints , debug etc.
Bam.... i can answer my first of the two questions now by myself. Thx to #agent_hunt, who put me into the right direction...
In this example application the bindings wasn't setup correctly. "rnpm link" and the newer one "react-native link", which is part of "react-native install", didn't worked correctly here for the android-part because it is not implemented in the 3rd-party-library right now, that i've used for this example.
That's why gradle didn't take notice of the library. After setting it up correctly, the folder react-native-sqlite-storage appeared in Android Studio and i was able to pass a breakpoint and to stop the execution there.
Nevertheless, debugging this library works fine, but when i wan't to step into lower/"deeper" methods of android SDK, it still has issues to point to the correct line of code ("Sourcecode does not match the byte code")
Two years ago I developed a Qt4 Android app using Ministro and it worked perfectly in that time. Right now I am porting the same code into Qt5. After updating several files I could compile and create the APK file in a pretty clean way.
Nevertheless, when I try to deploy the app into my tablet, it crashes showing these two error messages:
No implementation found for int[] org.qtproject.qt5.android.ExtractStyle.extractNativeChunkInfo()
And:
E/libEGL (11187): cache file failed CRC check
These are my settings:
QtCreator with Qt 5.5.1
Android Studio (Android 5.0.1 - API Level 21)
Android NDK (r10e)
Ant (1.9.6)
JDK (1.8.0_73)
Note: I tried to deploy my app from a virtual android device (using API 23) and I got the same result.
Finally I could solve the problem in a very strange way: I removed all the Android references in my code, including the android manifest.
In other words, I transformed my app into a "desktop" solution. Then, from QtCreator I made the deployment pointing to android and everything worked in a pretty clean way. I wonder how Qt solutions have evolved as an actual resource for mobile development in just few years.
I'm launching a game on Android device and getting this error. I`m using up to date Android version, also libgdx.
The library 'jinput-platform-2.0.5-natives-linux.jar' contains native libraries that will not run on the device.
The following libraries were found:
libjinput-linux.so
libjinput-linux64.so
Please help me understand what may cause the problem.
*.so files are native assemblies that are built for a particular architecture. If those *.so files were not built for android (and it seems as if they are not given the error) they will not work.
If there isn't a version for android already built, you can try to write an android version. This other SO question may be of assistance.