I can run and try ImageTarget project successfully and I can change marker and add my own model correctly. This project run perfect. but now i want to create my own project with different name. I copy the imagatarges project's java classes which are in src folder and also copy res folder for drawables and layouts. Also I add assets folder. After that I create my own xml files and their java classes. After that, i combine them. Also i add the qcar.jar file as referances libiries and jni folder to my project. But when i try to run my project i think that my project does not reach the .cpp classes. Because when start the program my interfaces came but after the some button clicks camera does not open like imagetarget project. How can i solve this problem? (ps:I did ndk build correctly)
- Sort Posts
- 9 replies
- Last post
New project problem
New project problem
I changed all of code like you said but still some errors are continue. I add logcat error message now. What i do wrong?
03-17 23:02:26.504: E/AndroidRuntime(26667): FATAL EXCEPTION: main
03-17 23:02:26.504: E/AndroidRuntime(26667): java.lang.UnsatisfiedLinkError: getOpenGlEsVersionNative
03-17 23:02:26.504: E/AndroidRuntime(26667): at org.example.treasurehuntnew.ImageTargets.getOpenGlEsVersionNative(Native Method)
03-17 23:02:26.504: E/AndroidRuntime(26667): at org.example.treasurehuntnew.ImageTargets.getInitializationFlags(ImageTargets.java:366)
03-17 23:02:26.504: E/AndroidRuntime(26667): at org.example.treasurehuntnew.ImageTargets.onCreate(ImageTargets.java:339)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.Activity.performCreate(Activity.java:4531)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2150)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2229)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.ActivityThread.access$600(ActivityThread.java:139)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.os.Handler.dispatchMessage(Handler.java:99)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.os.Looper.loop(Looper.java:154)
03-17 23:02:26.504: E/AndroidRuntime(26667): at android.app.ActivityThread.main(ActivityThread.java:4944)
03-17 23:02:26.504: E/AndroidRuntime(26667): at java.lang.reflect.Method.invokeNative(Native Method)
03-17 23:02:26.504: E/AndroidRuntime(26667): at java.lang.reflect.Method.invoke(Method.java:511)
03-17 23:02:26.504: E/AndroidRuntime(26667): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-17 23:02:26.504: E/AndroidRuntime(26667): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-17 23:02:26.504: E/AndroidRuntime(26667): at dalvik.system.NativeStart.main(Native Method)
New project problem
Ok, the error indeed confirms that it does not find those functions at runtime;
can you copy-paste here these:
- your package name
- the name of your main class, from which you call the native functions (i.e. the equivalent of ImageTargets.java, where you define your activity)
- the definition of a couple of functions from your "imagetargets.cpp" (or whatever it is called in your case)
I just would like to double-check, sometimes the error may be subtle...
New project problem
Our package's name is: org.example.treasurehuntnew
Main class's name name is: ImageTargets.java (we did not change the main class's name)
These are some definitions:
Java_org_example_treasurehuntnew_ImageTargets_getOpenGlEsVersionNative(JNIEnv *, jobject)
Java_org_example_treasurehuntnew_ImageTargets_setActivityPortraitMode(JNIEnv *, jobject, jboolean isPortrait)
Java_org_example_treasurehuntnew_ImageTargets_switchDatasetAsap(JNIEnv *, jobject)
New project problem
Yes, it is clicked but still have the same problems.
When I followed the logcat I saw a sentence like that: CheckJNI is off. Is this make problem? I tried my codes with HTC Sensation and the original project (ImageTargets) will work successfully.
And also I only changed ImageTargets.cpp's functions definition in jni folder because i didnt see any other changable functions in other cpp classes.
New project problem
Hi,
the issue might also be related to the module name of your native module;
if you open the Android.mk file (under the JNI dir) you should see a line like:
LOCAL_MODULE := ImageTargets
is it set to "ImageTargets" or something else ?
also, in Java (ImageTargets.java) you should have two lines like this:
Hi, have you also renamed the native functions in your CPP code, so to reflect your new package name and class name ?
As an example, consider the function startCamera defined in ImageTargets.cpp:
So, if you have created your own project, probably you are now using your own package name and/or class name;
you will need to reflect those names in the name of the natuve functions in CPP, as explained above.