Javah cannot find specified lib for jni/android-ndk - android

So, I have tried everything that I know of possible. I ran an export CLASSPATH=/path/to/bin/classes, and it still isn't able to find the output. I've tried running the command from $PWD/bin/classes, the project's root, and STILL am having troubles getting this to work properly. I have the latest version of the ndk (r8-1 at the time of this writing) and the sdk as well. Generating header files via command line, etc.
So far, I've seen Javah error while using Jni, as well as another question which specified the same problem and received the same answers.
I'm running Arch Linux (Archbang, specifically) in x86_64.
Here's my invocation and output (executed from $PROJECT_ROOT/bin/classes):
javah -d ../../jni com.example.fibonnacinative.libfib
Error: Could not find class file for 'com.example.fibonnacinative.libfib'
I've tried with the -classpath, -verbose, etc. flags and neither appear to help. -classpath just spits out the same error, and -verbose does not give me any information apart from the output I've posted.
Halp?

Yup! It was based on my stupidity.
I should have followed casing conventions for LibFib by typing com.example.fibonnacinative.LibFib as opposed to libfib.
Note: the class itself is typically camel case, whereas the rest of the package directive is lowercase. These are just conventions, mind you.
Sorry folks.

Related

How to fix CMAKE Android-Toolchain RPATH Problem

Im still on my big project with the topic of porting a big program written in c/c++ to Android.
It worked out fine so far and I could build it succesfully. But there is a problem when executing the files. First of all, there a problem with the libraries. I understand that RPATH is not provided with android.
So doing the following helped a little: LD_LIBRARIES_PATH=./lib programmBinary -v
This command shows the version info.
However, if I want to execute the program with this command it is stuck. Every binary I want to execute with this command is stuck and hangs up. For example there is a binary file which creates an .img during the build process. The binary depends on several other files in order to build the .img file. All necessary file are on the device. When executing the command to create the image its immediately stuck.
Could that be a problem with this command?
I also tried changing my CMakeLists.txt and set the it to set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Nothing changed. -v works and the rest not.
Any idea?
Maybe the problem lays somewhere else? In addition, some infos:
The program builds fine on linux. The .img File also creaties fine. Except when im using the LD_LIBRARIES_PATH=... command. Then I get an error message on Linux too. It says:
Error 3.1: Failure during initialization: File "" is unreadable.
Logic error: Error building kernel image. Image not saved.
fish: Job 1, 'LD_LIBRARY_PATH=./lib executable filename.img' terminated by signal SIGILL (Illegal instruction)
I appreciate any help.
Thank
Thomas

javah: Error: cannot access android.support.v7.app.AppCompatActivity?

I know there are similar questions here already, but none of them seem to help. I'm using Ubuntu 16.04
I'm trying to create a JNI file and folder in Android Studio, following this tutorial: https://www.youtube.com/watch?v=kFtxo7rr2HQ but no matter what I do I keep getting errors. I've got it to a point where it says:
Error: cannot access android.support.v7.app.AppCompatActivity
class file for android.support.v7.app.AppCompatActivity not found
Here is the command I am giving it:
javah -d jni -classpath ~/Android/Sdk/platforms/android-21/android.jar:../../build/intermediates/classes/debug com.example.ndktest.MainActivity
I have tried adding these two libraries, figuring that this would resolve my issue, but no luck:
javah -d jni -classpath ~/Android/Sdk/platforms/android-21/android.jar:~/android-support-v7-appcompat-master/libs/android-support-v7-appcompat.jar:~/android-support-v7-appcompat-master/libs/android-support-v4.jar:../../build/intermediates/classes/debug com.example.ndktest.MainActivity
This gives me the same error. I'm at a loss for what I can try next to make this work. Eventually my task is to integrate an application into an android build rom, but I need to understand Android.mk files first, and for that I need to understand how to use the NDK to use preexisting C++ code. Can anyone help?
The simplest way to solve this problem is change the AppCompatActivity to Activity, then you are good to go.
You are quit careful, since you change the semicolon to colon already. I make a mistake for that.

Javah cannot find khronos.opengles.GL10

There are similar questions addressed here, such as this one, but I've already checked their answers and, after implementing them, javah is still unable to find the javax.microedition.khronos.opengles.*; configuration.
I have my classpath (in eclipse) edited to include the Android SDK API 10 .jar file, so this should work. Is there an external environment variable I need to edit? I've already tried echoing out $CLASSPATH, which appears to be blank, so I have no idea what the issue is here,
and after exporting it to the location of my android.jar file, it still doesn't work.
Thus, I'm at a loss here as of what to do.
What could be done to solve for this? It appears the only issue really is this library, and nothing else.
For android-ndk-r8b and windows 7( 64 bit ) you must write -bootclasspath and point exactly to android.jar file and optionally -classpath. for example:
javah -classpath bin/classes -bootclasspath "C:\android-sdk\platforms\android-8\android.jar" com.example.SanAngeles.DemoRenderer

Why does Python fail to run ant build?

If I run ant release in the shell in my dir proj it works fine, however, when I try to execute it from python, it fails, why?
/Users/hunterp/proj
Buildfile: /Users/hunterp/proj/build.xml
BUILD FAILED
/Users/hunterp/proj/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project'
It is difficult to answer this question without more information about your setup or the code you are using. Particularly the parts that are generating the error since we don't know what your code looks like (either in build.xml or in your python script).
An easy thing to start with, as indicated by #Mark, is to <echo>${basedir}</echo> in your release task to see where exactly it thinks it is running from. My guess is that you are trying to load a properties file or some such and it isn't finding it in an earlier step.
What you can do if the location of ${basedir} looks different when run from within the directory versus within your python script is use a reference to where your build.xml file lives and reference from there:
<dirname property="project.basedir" file="${ant.file.project_name}"/>
Then use use ${project.basedir} instead of ${basedir}.
All of this assuming, of course, that your ${basedir} appears differently between the two. Otherwise I'd need to know more in order to diagnose the issue.

How to build Android NDK sample: "bitmap-plasma"

I am trying to build the bitmap-plasma sample that is included with the ndk, but getting an error. I run ndk-build from the samples/bitmap-plasma directory, and the error it displays is that it cannnot locate android/bitmap.h file.
How do i direct the ndk-build script to the file it needs?
Using android-ndk-r4 on Ubuntu Lucid 10.04
Well it's working now, so in case anyone was having my same problem:
There as an android-ndk-r4b bugfix release today, which it seems no longer has this problem.
Available to download here.
http://developer.android.com/sdk/ndk/index.html
With Ubuntu 10.04 and NDK r5b, I have just posted a bug report (with the fix included) for build_platforms.sh. See http://code.google.com/p/android/issues/detail?id=15180 for details. Essentially, the local declarations in the symlink routine must be amended. Otherwise, it only links the first file (alphabetically) from each directory, and truncates the remainder from the list.
Correcting this allowed the symbolic links to be fully populated, thereby filling in the missing header files and libraries and allowing the samples to build successfully.

Categories

Resources