Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

2019.1.1 AKDEBUG: Java VM not initialized or not provided in AkInitSettings.

0 votes

Hello,

We're currently in the process of trying to upgrade from 2016.1.1 to the latest 2019.1.1 release, but are running into a failure when attempting to initialize the sound engine. This is with a mixed Java/C++ game, not a native NDK activity based app. 

The following code is used for sound engine initialization, the Java VM is obtained from the initial JNI_OnLoad(JavaVM * vm, void *reserved) call which happens when our library is loaded. This works fine in 2016.1.1 but fails under 2019.1.1 for some reason. I'm unable to debug this further as I lack the source code to the SoundEngine. 

 AkInitSettings initSettings;
 AkPlatformInitSettings platformInitSettings;
 AK::SoundEngine::GetDefaultInitSettings( initSettings );
 AK::SoundEngine::GetDefaultPlatformInitSettings( platformInitSettings );
 platformInitSettings.pJavaVM = OurCustomLib->GetJavaVM();
 if ( AK::SoundEngine::Init( &initSettings, &platformInitSettings ) != AK_Success ) -> Failure: AKDEBUG: Java VM not initialized or not provided in AkInitSettings.

Please advise.

Thanks

asked Jun 27, 2019 in General Discussion by Gregg W. (100 points)

1 Answer

0 votes

你好,大神,我也遇到这个问题

AkPlatformInitSettings platformInitSettings;
JavaVM* jvm = cocos2d::JniHelper::getJavaVM();
platformInitSettings.pJavaVM = jvm;


JNIEnv* env = cocos2d::JniHelper::getEnv();
jclass classID=env->FindClass("org/cocos2dx/javascript/AppActivity");
jmethodID methodID = env->GetStaticMethodID(classID, "getInstance", "()Ljava/lang/Object;");
platformInitSettings.jActivity = env->CallStaticObjectMethod(classID, methodID);

AKRESULT res0 = m_pLowLevelIO->Init(platformInitSettings.pJavaVM,platformInitSettings.jActivity);

 

AKRESULT res1 = AK::SoundEngine::Init(&initSettings, &platformInitSettings);//Java VM not initialized or not provided in AkInitSettings.
answered Oct 12, 2023 by afd d. (270 points)
...