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
Related
This question already has answers here:
Android CMake: Could NOT find OpenSSL
(4 answers)
Closed last month.
This seems like a frequent issue but I can't figure it out...
I'm trying to compile some libraries which use OpenSSL. They use CMake and are unable to find OpenSSL, even though I made a local build of BoringSSL and set OPENSSL_ROOT_DIR to its install directory.
To work on the issue more easily, I made a test CMakeLists.txt, here it is completely:
cmake_minimum_required(VERSION 3.22.1)
project(test)
find_package(OpenSSL REQUIRED)
This fails with:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR)
I do have OPENSSL_ROOT_DIR environment variable set to the install directory inside my local BoringSSL build:
% echo $OPENSSL_ROOT_DIR
/Users/[...]/deps/boringssl/cmake-build-debug-arm64-v8a/install
The files are there:
% ls $OPENSSL_ROOT_DIR/include/openssl/ (main|…6)
aead.h cipher.h engine.h
....... ssl.h
% ls $OPENSSL_ROOT_DIR/lib (main|…6)
libcrypto.a libssl.a
I that know CMake (specifically FindOpenSSL.cmake) looks for openssl/ssl.h under include like this:
find_path(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_INCLUDEDIR}
${_OPENSSL_INCLUDE_DIRS}
PATH_SUFFIXES
include
)
I even hacked FindOpenSSL.cmake to print out _OPENSSL_ROOT_HINTS_AND_PATHS here it is:
STATUS,*** Hints and paths = HINTS;/Users/[...]/deps/boringssl/cmake-build-debug-arm64-v8a/install;ENV;OPENSSL_ROOT_DIR;PATHS
Which has the right path already, plus it refers to the OPENSSL_ROOT_DIR environment variable.
And yet I still get the error.
This seems almost magical and in a bad way. Any ideas?
I've tried using cmake 3.22.1 from the Android SDK and the native (MacOS) cmake 3.24.3, both error out the same way.
Also tried:
set(OPENSSL_ROOT_DIR .......)
right CMakeLists.txt, same error. Magic!
Update
The error is caused by
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake
If I remove it, the error goes away.
Yes I'm trying to compile for Android. So the Android toolchain is somehow messing up CMake's ability to find OpenSSL. I am using the latest NDK, 25.1.8937393.
There is detailed description of why this happens here:
Android CMake: Could NOT find OpenSSL
This works for me:
list(APPEND CMAKE_FIND_ROOT_PATH "$ENV{OPENSSL_CUSTOM_ROOT_DIR}")
find_package(OpenSSL)
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.
I'm trying to get an (inherited) Android project to build. I'm using Ant & command line tools (and IDEA).
In styles.xml, there are references that cannot be resolved such as:
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light">
This is the original error I ran into:
[...]/res/values/styles.xml:8: error: Error retrieving parent for item:
No resource found that matches the given name '#style/Theme.AppCompat.Light'.
I then noticed that project.properties has this appcompat reference which is broken on my (OS X) machine:
target=android-18
android.library.reference.1=../../../../adt-bundle-linux-x86_64/sdk/extras/android/support/v7/appcompat
I tried to fix that by making the reference relative to ${sdk.dir}:
android.library.reference.1=${sdk.dir}/extras/android/support/v7/appcompat
So now that path should be correct. But now when I run ant debug:
BUILD FAILED
/opt/android-sdk-macosx/tools/ant/build.xml:573:
/opt/android-sdk-macosx/extras/android/support/v7/appcompat resolve to a
path with no project.properties file for project /Users/joka/devel/project/
So, any ideas? What's the simplest way to get this project built?
(Please note that Ecplise-specific advice won't be useful to me.)
Edit: The Android SDK installation looks like this:
As Jay indicated, only relative paths will work on Unix/Mac.
For the Ant build to work, I also needed to generate build.xml for the appcompat project, using the command android update project -p <dir>, in my case:
/opt/android-sdk-macosx/tools/android update project
-p /opt/android-sdk-macosx-r22.0.1/extras/android/support/v7/appcompat
The exact config for me was:
android.library.reference.1=../../../../../../../opt/android-sdk-macosx/extras/android/support/v7/appcompat
(This also works in local.properties, which I think is a better place since the same path won't work for all developers.)
I merely promoted my comment from 6 months ago into an answer as someone suggested.
By the way, now that I actually know something about Android development, I'd urge anyone who has the chance to ditch Ant and look into the new Gradle-based build system which is totally sweet in comprarison. It is CI-friendly and makes it easy to automate useful things (like using different package name and app icon for different build types). Stack Overflow will help when you run into problems.
Using the support libraries with Gradle, you'd skip all the above hassle and simply do:
dependencies {
compile "com.android.support:appcompat-v7:18.0.+"
}
I ran into the same problem, so I tried using a relative path and that fixed the problem for me. It looks like only relative paths work with android.library.reference. I did a quick search to verify this, and came across this stackoverflow link which indicates that absolute paths will work with android.library.reference on Windows, but not on Unix or Mac.
Peace.
Your path seems to be wrong (you are missing the 'compatibility' part).
The v7-appcompat library is at
{sdkpath}/extras/android/compatibility/v7/appcompat
for me (SDK Tools version 22.0.5 on Max OS X 10.7.5)
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.
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.