Cocos2d-x android 无法解析 coscos2dx 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12654078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocos2d-x android can't resolved coscos2dx library
提问by user1708211
i am starting by macOSX xcode4.5 .
i tried to tutorials.
我从 macOSX xcode4.5 开始。
我试图教程。
Using cocos2dx, it completes building of macOSX,
The problem occurred in android sources.
使用cocos2dx,完成macOSX的搭建,
问题出现在android源码。
No contents of cocos2dxActivity are described.
so, org.cocos2dx.lib is not other files.
没有描述 cocos2dxActivity 的内容。
所以,org.cocos2dx.lib 不是其他文件。
android is not running.
安卓没有运行。
i use ndk-r8. What will be a problem?
我使用 ndk-r8。会有什么问题?
回答by user1169079
In cocos2d-x 2.0.3 ...Cocos2d-x Lib java files has been considered as a different project only So import that project in the eclipse
在 cocos2d-x 2.0.3 ...Cocos2d-x Lib java 文件被认为只是一个不同的项目 所以在 eclipse 中导入那个项目
Lets make it Simple
让它变得简单
- First Import the project in eclipse from this path - cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java
- 首先从这个路径导入eclipse中的项目——cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java
You will see libcocos2dx project in eclipse ...Keep this project open always otherwise your projects will give error on the syntax of library
您将在 Eclipse 中看到 libcocos2dx 项目...始终保持此项目打开,否则您的项目将在库的语法上出错
Run create-android-project
Now Import the project which you have created and just Run (If you know the concept of isLibrary then that's how they are maintaining it now ..)
运行 create-android-project
现在导入您创建的项目并运行(如果您知道 isLibrary 的概念,那么这就是他们现在维护它的方式..)
Also additional information to run build-native.sh from eclipse only , Right Click Project ->C/C++ Build Uncheck Use Default Build COmmand and add following bash ${workspace_loc:/YourProjName}/build_native.sh NDK_DEBUG=1 V=1
还有其他信息仅从 Eclipse 运行 build-native.sh,右键单击项目 ->C/C++ 构建取消选中使用默认构建命令并添加以下 bash ${workspace_loc:/YourProjName}/build_native.sh NDK_DEBUG=1 V=1
Good Luck ..If any question please feel free to ask
祝你好运..如果有任何问题,请随时问
回答by Ignacio Gómez
Change
改变
import org.cocos2dx.lib.Cocos2dxActivity;
to
到
import android.app.Activity;
and change
和改变
extends Cocos2dxActivity
to
到
extends Activity
回答by Hossam Ghareeb
You can copy the folder (cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java)beside the proj.android folder of your game folder, then import it with the game in eclipse.After importing these 2 projects, open Properties of the game and then add libcocos2dxas library and click apply and build.
你可以复制你的游戏文件夹proj.android文件夹旁边的文件夹(cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java),然后在eclipse中和游戏一起导入。 导入这2个项目后,打开游戏的属性,然后添加libcocos2dx作为库,然后单击应用和构建。
i have tries these and works for me
我已经尝试过这些并且对我有用
回答by user1708211
i figure out by myself..
我自己想出来的。。
Using cocos2dx 2.0.3 (2012-09-26),
eclipse source:org.cocos2dx.lib is not created.
(org.cocos2dx.lib is created cocos2dxActivity only.
and cocos2dxActivitiy is no contents described.
使用 cocos2dx 2.0.3 (2012-09-26),
eclipse source:org.cocos2dx.lib 没有被创建。
(org.cocos2dx.lib 只创建了 cocos2dxActivity。cocos2dxActivitiy
没有描述内容。
cocos2dxActivity:
package org.cocos2dx.lib;
mport android.app.Activity;
public class Cocos2dxActivity extends Activity{
}
)
cocos2dxActivity:
包 org.cocos2dx.lib;
导入 android.app.Activity;
公共类 Cocos2dxActivity 扩展 Activity{
}
)
therefore,
Using cocos2dx 2.0.2 (2012-08-30), eclipse build ok.
因此,
使用 cocos2dx 2.0.2 (2012-08-30),eclipse build ok。
i can't understand what is problem...
我不明白什么是问题...