Unresolved external symbol while trying AndroidJNI

As a disclaimer, I’ve only used UE4 on the beginning of the year (using blueprints) and only tried using C++ This August because I want to be able to access android’s GPS to know where the mobile’s location is.

While testing AndroidJNI I encountered this error

"Error	LNK2001	unresolved external symbol "__declspec(dllimport) class TBaseDelegate<void> OnAndroidDoSomething" (__imp_?OnAndroidDoSomething@@3V?$TBaseDelegate@X$$V@@A)	GPS_Testing	C:\Path to Project\Intermediate\ProjectFiles\MyActor.cpp.obj	1"

I followed these great people’s process for using AndroidJNI:

but ended up with the above error. Can anyone guide me as to how to resolve this issue? And if you can please do.

I can send in snippets of codes or logs if asked. Thanks!

EDIT: The error occurs when I call OnAndroidDoSomething.Execute() a delegate of a function

The error you provided means the body (implementation) for OnAndroidDoSomething() does not exist.

I assume you have gotten the code posted here or something similar. I am guessing that you have passed &OnAndroidDoSomething to CreateStatic.

You now need to create a C++ static method called OnAndroidDoSomething(). Using the code provided in those threads I imagine the contents of this method should be the following:

void OnAndroidDoSomething()
{
	if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
	{
		FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, FJavaWrapper::TheStaticMethodToCallInJava);
	}
}

Thanks for the reply. What I created was this on AndroidJNI.cpp:

void AndroidThunkCpp_DoSomething()
{
	if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
	{
		FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, FJavaWrapper::AndroidThunkJava_DoSomething);
	}
}

On the JNI_Onload This is how I create static

   DECLARE_DELEGATE(FAndroidDoSomethingDelegate);
	extern CORE_API FAndroidDoSomethingDelegate OnAndroidDoSomething;
	OnAndroidDoSomething = FAndroidDoSomethingDelegate::CreateStatic(&AndroidThunkCpp_DoSomething);

I already have those in my code. What seems to be missing?