I am making a project in Cocos creator 3.5 and when I build Android proj in Cocos creator it is successful but after that, it is not running in android studio.
the error is as follows :
In file included from C:\Users\userName\Desktop\running game backup\Game_name\native\engine\android\jni\main.cpp:25:
C:\Users\userName\Desktop\running game backup\Game_name\native\engine\common\Classes\Game.h:27:10: fatal error: ‘platform/Application.h’ file not found
Make sure you are following the doc
@pandamicro i already followed all steps but not working and getting same error
Hi bro, which version of java and sdk android are you using
Hii @mohammedhayder ,
i am using android studio default JDK java 11.0.12 and android sdk target 31.
i use same configuration for other projects and works fine.
What’s the difference between these projects and the failing one ? It seems the android studio can’t find the engine files, so you can check whether you have upgraded engine or editor after the project creation or first Android build.
You might need to delete the
native folder in your project and rebuild for Android
for now, I use hello world as a template when I create a project but if I use an empty project it throws this error
It seems that the issue you’re encountering might be due to building your project with an older version of Cocos Creator and then experiencing errors during compilation after an upgrade. You can refer to the Cocos Creator release notes documentation for guidance on upgrading your project. Upgrade Guide · Cocos Creator
If you haven’t made any modifications to the native/ directory within your project folder, you can simply delete it and rebuild the project.
It is important to note that when opening a project in Android Studio, you should utilize the
build/android/proj directory instead of the
i tried with new project as well and using same directory as you mentioned
You have to open proj from build/android directory after you made a build from Cocos Creator. Then it’s qite messy, the docs are not full. Don’t touch any gradle or java level versions. Use ndk 21, and cmake 10. Then it should build both from android studio and cocos creator. It’s possible to uprade to latest versions of ndk, java and gradle, but on your own risk, be careful!
yes bro actually there are different kind of errors I face every time I work on new project when building android project
Make sure your follow Android build step in Documentation. And…
Try go to File > Project structure. And set Android Gradle Plugin Version to 7.1.0 and Gradle Version to 7.2
i use same gradle version as you mentioned and follow cocos creator build docs also.