Migration to cocos2d-x3alpha

Migration to cocos2d-x3alpha
0.0 0


Hello, after upgrading to latest cocos I found that I don’t know how to load shared libs in java side. Before this, I used file: proj.android/src/org/sometitle/sometitle.java in the class which extends Cocos2dxActivity:


Now, cocos uses native activity and I don’t know how to work with it.
Also, it can’t find the lib of the project:

09-29 15:17:14.026: E/AndroidRuntime(16983): FATAL EXCEPTION: main
09-29 15:17:14.026: E/AndroidRuntime(16983): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sometitle.sometitle/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.sometitle.sometitle-1/libcocos2dcpp.so


I recently encountered the same issue. It is a different scenario, but you can use jni and hook into nativeactivity.cpp as a quick/dirty solution. There may be a more ideal solution of custom hooks instead of modifying the cocos2dx nativeactivity.cpp source, but you can see the thread here:


Found this:

meta-data in AndroidManifest.xml to specify lib name is excellent [1]. 
It helps write pure c/c++ native activity based apps on Android through NDK. 

However when multiple shared libraries need to be loaded, the only option that works is to subclass NativeActivity in Java and calling System.loadLibrary() for each *.so used.

=( I know nothing about java + ndk integration.



Do you resolve this problem? because i’m trouble building cocos2d-x 3.0 hellocpp with ndk-build, i believe that problem in references to ndk build, maybe the same way that this problem,