I’m able to build a sample project successfully. But, when I run it on emulator this is the error I get:
10-18 13:02:57.763 8915-8915/org.cocos2dx.HeliosGame E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.cocos2dx.HeliosGame, PID: 8915
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/org.cocos2dx.HeliosGame-1/base.apk”],nativeLibraryDirectories=[/data/app/org.cocos2dx.HeliosGame-1/lib/x86, /system/lib, /vendor/lib]]] couldn’t find “libMyGame.so”
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
My cocos2d-x folder is on Drive C and my project folder is in Drive D:
I hope this is not causing the issue.
I’m editing your post “begging for help”. You have begged for help in your last few posts. It is rather impolite when people are already trying to help you.
I’d definitively test on hardware too. I never have luck with emulators.
You can try moving your project to C: (or your cocos2d-x to D:) to test as well. Perhaps this is an issue. I do think folks have projects on separate drives. I don’t, but I think this might be a common practice.
nope. You can, but usually no. Back in the 2.2.x days this is how it worked. Projects were created inside of the cocos2d-x/ root in projects. In 3.x this changed to where ever you wish.
Indeed, I kind of remembered some changes like that, a good improvement. I know some people are successfully running their projects in the emulator so I don’t understand the error. I don’t have a real device as of now.
I encountered an error when I ran your suggested command. I’ll try to download the x86 ABI system image for Android 22 and do it again. Maybe that’ll will change my luck.
A similar problem is occurring for my MacOSX attempt. I installed Cocos2d-x and followed the instructions. Got it to work for Xcode, but Android studio is throwing the error:
“java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/org.cocos2dx.cpp_tests-2/base.apk”],nativeLibraryDirectories=[/data/app/org.cocos2dx.cpp_tests-2/lib/x86, /vendor/lib, /system/lib]]] couldn’t find “libcpp_tests.so””
I’m not sure how to resolve this .so file error. I remember long ago while troubleshooting Scilab projects .so file errors would pop up quite often so I’d like to understand why this happens (now that I’m a developer in training) as well.
As have been suspected, Android Studio’s emulator for some reason can’t run this. Either you run this on real device or use BLUESTACKS emulator instead.
Hey, I should have replied much sooner, but yes there’s some trouble with the emulator. It runs fine on the actual device! I wonder why.
@slackmoehrle - Like reyanthonyrenacia said, I was just starting out with cocos2d-x so I followed the online guide and ran cpp-tests as written there. That is all
I’m not sure either. I have never been able to run on an emulator for the past 2 years and I know others have had difficulty too. Thank you for testing this!
Tried every single one of the suggested solutions, i.e.
Run on emulator - didn’t work
Run on actual device - didn’t work
Compile from command line and then install by copying apk - didn’t work
Compile and install from Android studio - didn’t work
Updating Application.mk and gradle.properties. Details of this one as follows:
In Application.mk to APP_ABI := all (Or a list - armeabi armeabi-v7a x86 arm64-v8a)
In gradle.properties set PROP_APP_ABI=all (or the list - armeabi-v7a x86 armeabi arm64-v8a)
and add -> android.useDeprecatedNdk=true
In Project’s build.gradle, inside defaultConfig, added the following:
ndk {
abiFilters “all” (or “armeabi-v7a”, “x86”, “armeabi”, “arm64-v8a”)
}
But this also didn’t work!!
For the sake of clarity, the compilation and building apk works fine. The app installs also. But the app crashes as soon as it is launched. BTW, am not running HelloWorld app, I am deploying my own app. It is compiling and running fine on iPhone simulators, running fine on actual iPhone. Just crashing on Android.
Can someone please help? Have followed multiple posts, but none of the solutions seem to work.
More info, am running the latest version of cocos, i.e. 3.16, latest version of studio, i.e. 3.0.1, buildToolsVersion 27.0.1, build gradle 3.0.1
What else can I provide to help debugging? @slackmoehrle, do you know what needs to be done?