When calling javah on a .java file in my android project, javah was unable to find the android classes (specifically android.graphics.Bitmap).
here's the terminal output:
thomas#THOMASDESKLINUX:~$ javah -classpath .:/home/thomas/Documents/LinuxProgramming/EclipseWorkspace/RenderScene/bin org.me.renderscene.Billboard
javadoc: error - In doclet class com.sun.tools.javah.MainDoclet, method start has thrown an exception java.lang.reflect.InvocationTargetException
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.graphics.Bitmap not found
1 error
help appreciated!
you need to add {android-sdk-path}\platforms\android-8\android.jar also to the classpath
Related
I was working on book "Chapter-3-Communicating-with-Native-Code-Using-JNI.pdf". There when I tried to create header files using javah command I get the error:
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: ?classpath
I tried the instruction in terminal:
javah –classpath bin/classes com.example.hellojni.HelloJni
But i see that this is for Eclipse paths and I am using Android Studio. So I tried this:
..helloJni\app>javah -d jni –classpath build\intermediates\classes\arm7\debug com.example.hellojni.HelloJni
I have HelloJni.class file in "helloJni\app\build\intermediates\classes\arm7\debug\com\example\hellojni". I am still getting the same error and I am surprised that I couldn't find a direct solution on stackoverflow. Can you help me with this?
Did you copy the -classpath argument from somewhere? Your error message indicates that javah thinks -classpath is the class name. And as it shows ?classpath in the output, it seems the - is not what you think is, but some special character. Try typing -classpath yourself.
Edit: was curious. What you have instead of - is an –
I'm getting the following error while building Android ROM, either it is AOSP/CyanogenMod
In file included from hardware/ril-caf/libril/RilSapSocket.cpp:21:0:
hardware/ril-caf/libril/RilSapSocket.h:22:55: fatal error: hardware/ril/librilutils/proto/sap-api.pb.h: No such file or directory
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
^
compilation terminated.
When I look into the path in github.com/CyanogenMod and github.com/Android I couldn't find sap-api.pb.h
What could be the problem and how can I resolve it?
I got the same error message, and I tried to find the generated file with find command:
$ find . -name "sap-api.pb.h"
./out/target/product/bacon/gen/STATIC_LIBRARIES/librilutils_static_intermediates/proto/hardware/ril-caf/librilutils/proto/sap-api.pb.h
./out/target/product/bacon/gen/SHARED_LIBRARIES/librilutils_intermediates/proto/hardware/ril-caf/librilutils/proto/sap-api.pb.h
then I notice the #include path is a bit different from the real path, I open the error .h file and change hardware/ril/... to hardware/ril-caf/... in these two files:
hardware/ril-caf/libril/rilSocketQueue.h
hardware/ril-caf/libril/RilSapSocket.h
Then, the build passed.
Hope this help.
I'm trying to get Daniel Waldron's CircularBarPager working with Android Studio but unfortunately it won't work.
error:E/dalvikvm: Could not find class 'com.github.OrangeGangsters.circularbarpager.library.CircularBar', referenced from method com.github.OrangeGangsters.circularbarpager.library.CircularBarPager.initializeView
Error: Could not find comes when you are trying to run your Java
program using java command with the class is not able to find the
class.
You need to follow CircularBarPager Instructions .
Just add this to your build.gradle file
compile 'com.github.orangegangsters:library:1.3.4#aar'
Example
dependencies {
compile 'com.github.orangegangsters:library:1.3.4#aar'
}
Then Clean-Rebuild-Restart Your Project .Hope it will works .
I use ant to unzip an apk file, but it occurred an error like this:
<unzip src="test.apk" dest="testdir" >
error message:
java.lang.RuntimeException: data starting at 0 is in unknown format
i googled it, and add attribute encoding="native-encoding" , it still error.
great thanks for any help!
ok,finally I wrote a custom ant task using java ziputil to unzip an apk files. It does work well.
I'm trying to replicate this class called MediaMetadataRetriever in my own android project. You can see the class here:
https://android.googlesource.com/platform/frameworks/base/+/master/media/java/android/media/MediaMetadataRetriever.java
In line # 40 you can see: System.loadLibrary("media_jni");
How do I get that library? My logcat shows this:
Caused by: java.lang.UnsatisfiedLinkError: Library media_jni not found
This is a JNI class, which is created in C/C++ and included as a SO in your app. The class is loaded during runtime.
Look here https://android.googlesource.com/platform/frameworks/base/+/master/media/jni