cocos2dx JNIHelper lib is missing - android

I'm trying to add JNI to my project but I'm getting linker error:
Error 1 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: static bool __cdecl
cocos2d::JniHelper::getStaticMethodInfo(struct cocos2d::JniMethodInfo_&,char const *,char const *,char const *)" (__imp_?getStaticMethodInfo#JniHelper#cocos2d##SA_NAAUJniMethodInfo_#2#PBD11#Z)referenced in function _callEndGame AndroidJNI_EndGameDelegate.obj Proj.win32
Inside libcocos2d.lib there is no such a function because cocos2d-win32.vc2012.sln project didn't compile cocos2d-x-2.2.4\cocos2dx\platform\android folder.
How can I resolve it?

Problem solved!
It appears because I tried to compile my project from VS.
But when I use native_build.sh compilation was done without errors.

Related

undefined reference to `cnss_get_platform_cap'

I am compiling Android Kernel 3.18.
I am getting this error
drivers/built-in.o: In function `enable_extldo':
/home/vinay/customKernel/3.18/kernel_yu_msm8937/drivers/bluetooth/bluetooth-power.c:307: undefined reference to `cnss_get_platform_cap'
/home/vinay/customKernel/3.18/kernel_yu_msm8937/drivers/bluetooth/bluetooth-power.c:307:(.text+0x5c45bc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `cnss_get_platform_cap'
Makefile:951: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
Here is the source code
I am using aarch64-linux-android-4.9 toolchain
I encountered the same problem when I tried to compile a kernel for a MI device.
First you can see the function cnss_get_platform_cap was declared in cnss.h which is located in include/net:
And you open this file you will find this function was declared as a extern one:
So it is only a declaration here, not a implement.
Then we have a dig where the function is, I used find command to find all cnss related driver files and I find this function was implemented in ./net/wireless/cnss/cnss_pci.c
As we can see, the function was here and it will be a exported symbol after compiling.
And you can log your compile process and you will find actually succeed to compile bluetooth-power.c
Just when the makefile link vmlinux it will be a problem. So here we are. I searched the log and I didn't find cnss_pci.c was ever compiled, only cnss_common.c was compiled, let's open the sub-makefile in net/wireless/cnss/
You will find you need to add a item in your defconfig file to compile cnss_pci.c which is 'CONFIG_CNSS_PCI=y'. I add it to my defconfig file in arch/arm64/configs/xxx_defconfig and I solved this.
I just tried to merge a vendor patch into a newer CAF kernel, and there are many many syntax errors even with auto merge.
As for the logic error and bugs, I don't know. A lot of things need to learn.
Hope you find your way out.

Android project in koltin fails when execute ./gradlew build in terminal but works when run from menu

I'm trying to work with Travis CI, and previously I have try to build my project in the Android Studio's terminal with ./gradlew build or with ./gradlew clean build but both throws "Execution failed for task ':presentation:compileReleaseKotlin'." however when I build my project from the Android Studio's toolbar it works perfectly.
You can see the whole stacktrace and all the information here gradle stacktrace
Thanks in advance,
Javi
Check your Constants class for errors.
e: /Users/jcamarero/AndroidStudioProjects/boton/presentation/src/main/java/com/b4motion/boton/utils/Constants.kt: (48, 31): Const 'val' initializer should be a constant value
e: /Users/jcamarero/AndroidStudioProjects/boton/presentation/src/main/java/com/b4motion/boton/utils/Constants.kt: (48, 46): Unresolved reference: URL_WEB_VIEW
e: /Users/jcamarero/AndroidStudioProjects/boton/presentation/src/main/java/com/b4motion/boton/utils/Constants.kt: (49, 29): Const 'val' initializer should be a constant value
e: /Users/jcamarero/AndroidStudioProjects/boton/presentation/src/main/java/com/b4motion/boton/utils/Constants.kt: (49, 44): Unresolved reference: URL_WEB_VIEW
This error says that you have a const val in your Constants class defined but it is not constant at compile time. Also, it cannot find reference to URL_WEB_VIEW.

C, Android NDK: import own input.h version containing missing declarations

I'm trying to get the Eventinjector project from pocketmagic.net found here.
This means working with a precoded jni library writen in C. My problem is that I get some build errors when I try to compile the native code. The error log is long and I believe all errors are the same, therefore I'll only post part of it.
jni/EventInjector.h:718:9: error: (near initialization for 'mt_tool_labels[0].value')
jni/EventInjector.h:719:9: error: 'MT_TOOL_PEN' undeclared here (not in a function)
jni/EventInjector.h:719:9: error: initializer element is not constant
jni/EventInjector.h:719:9: error: (near initialization for 'mt_tool_labels[1].value')
jni/EventInjector.h:720:9: error: 'MT_TOOL_MAX' undeclared here (not in a function)
jni/EventInjector.h:720:9: error: initializer element is not constant
jni/EventInjector.h:720:9: error: (near initialization for 'mt_tool_labels[2].value')
jni/EventInjector.c: In function 'debug':
jni/EventInjector.c:82:2: error: format not a string literal and no format arguments [- Werror=format-security]
cc1.exe: some warnings being treated as errors
make: *** [obj/local/armeabi/objs/EventInjector/EventInjector.o] Error 1
Going throught the comments under the blogpost I discovered that "Alessandro" had the same problem but had found a solution. (post 51) " I had the same issue and imported my own input.h version containing all the missing declarations."
This is the part of the .c file that generates most of the errors:
static struct label key_labels[] = {
LABEL(KEY_RESERVED),
LABEL(KEY_ESC),
LABEL(KEY_1),
LABEL(KEY_2),
LABEL(KEY_3),
LABEL(KEY_4),
LABEL(KEY_5),
LABEL(KEY_6),
LABEL(KEY_7),
LABEL(KEY_8),
LABEL(KEY_9),
LABEL(KEY_0),
LABEL(KEY_MINUS),
LABEL(KEY_EQUAL),
LABEL(KEY_BACKSPACE),
...
I have no experience in C, and don't know what he means. So my question is: how do I do this?
I have succesfully compiled other JNI libs, using NDK v9 and cygwin, so there should not be a problem with my settings and enviroment.
I had the same issue and imported my own input.h version containing all the missing declarations.
You can do same thing and replace your input.h (you can search for input.h with those undefine identifiers in linux kernel sources), but easier way is to remove lines containing undefined identifiers from EventInjector.h. Just comment all lines that highlighted red in eclipse, and it should work.

error build cocos2dx android

I build cocos2d-x android project on windows 7.
$. / Build_native.sh - run, and the process falls on
Compile++ thumb : cocos2dx_static <= CCFileUtilsAndroid.cpp
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp: In member function 'virtual bool cocos2d::CCFileUtilsAndroid::isFileExist(const string&)':
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:9: error: 'FILE' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:15: error: 'fp' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:50: error: 'fopen' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:92:22: error: 'fclose' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp: In member function 'virtual unsigned char* cocos2d::CCFileUtilsAndroid::getFileData(const char*, const char*, long unsigned int*)':
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:13: error: 'FILE' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:19: error: 'fp' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:50: error: 'fopen' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:137:32: error: 'fseek' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:138:28: error: 'ftell' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:141:62: error: 'fread' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:142:22: error: 'fclose' was not declared in this scope
/cygdrive/d/work/Android/android-ndk-r8-crystax-1/build/core/build-binary.mk:320: recipe for target `obj/local/armeabi/objs/cocos2dx_static/platform/android/CCFileUtilsAndroid.o' failed
ScreenShot : http://joxi.ru/wy6OUdg5CbBkfuw7mZ4
How to fix it to build the project on?
Seems the Cocos2d-x code is not including the cstdio header where those things are declared. To fix this, edit the CCFileUtilsAndroid.cpp file and add the line
#include <cstdio>
up there at the top with the other includes. Now all those f* functions and FILE should be found.
have you solved this problem? Arleryd's solution worked for me, and the later error you post could be solved by this:
import the C:\cocos2d-x-2.2.0\cocos2dx\platform\android to eclipse, then done. see this:
http://www.cocos2d-x.org/wiki/How_to_set_up_the_android_cocos2d-x_development_environment_on_Windows_7

Errors when trying to interface Android with Arduino

I'm currently working on a project trying to get my Samsung Galaxy S2 to interface with the Arduino Mega ADK for Android and I'm getting a bunch of errors.
I've followed directions given here: http://stream.tellart.com/controlling-arduino-with-android/ to the letter. And I've tried running their examples
Specifically the "TapOn" Example (which should allow me to control an LED connected to Arduino from my Android). But each time I run it I get errors on both the processing code for the Android and the arduino code.
Arduino Errors:
AndriodAccessory has not been declaired
AndroidAccessory.cpp:38: error: 'AndroidAccessory' has not been declared
AndroidAccessory.cpp:43: error: ISO C++ forbids declaration of 'AndroidAccessory' with no type
AndroidAccessory.cpp: In function 'int AndroidAccessory(const char*, const char*, const char*, const char*, const char*, const char*)':
AndroidAccessory.cpp:43: error: only constructors take base initializers
AndroidAccessory.cpp: At global scope:
AndroidAccessory.cpp:54: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp: In function 'void powerOn()':
AndroidAccessory.cpp:56: error: 'max' was not declared in this scope
AndroidAccessory.cpp:57: error: 'delay' was not declared in this scope
AndroidAccessory.cpp: At global scope:
AndroidAccessory.cpp:60: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:60: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:61: error: expected ',' or ';' before '{' token
AndroidAccessory.cpp:71: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:71: error: variable or field 'sendString' declared void
AndroidAccessory.cpp:71: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:71: error: expected primary-expression before 'int'
AndroidAccessory.cpp:71: error: expected primary-expression before 'const'
AndroidAccessory.cpp:82: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:82: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:83: error: expected ',' or ';' before '{' token
Android/Processing Errors:
Error from inside Android tools
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\Users\Nate\Desktop\AndriodSDK\tools\ant\build.xml:705: The following error occurred while executing this line:
C:\Users\Nate\Desktop\AndriodSDK\tools\ant\build.xml:718: Compile failed; see the compiler error output for details.
I don't understand whats wrong and why I'm getting these errors when I haven't changed any of the code from the samples. Also I can write programs for the arduino and android independently of each other, and they work fine... I only get the errors when I want the two to communicate with each-other.
Looks like your code has no library to work with. For me that meant roaming the internet till I found the correct libraries. I would try the following:
Make sure you have the latest Arduino IDE
Download the libraries, probably this.
Although if you want just try the step by step here.

Categories

Resources