我是Android Studio开发人员的新手,我在窗口7(64位)上学习Cocos2d-x,我创建了一个项目
的Cocos2D-X。当我将此项目导入Android Studio 1.1.0并在Android Studio中运行时,我收到了错误消息。 我也在寻找同样错误的答案,但它们并不适合我。希望大家帮助我,非常感谢
这是我的错误。
Information:Gradle tasks [:testCocos:assembleDebug]
WARNING [Project: :testCocos] Current NDK support is deprecated. Alternative will be provided in the future.
:testCocos:preBuild UP-TO-DATE
:testCocos:preDebugBuild UP-TO-DATE
:testCocos:compileDebugNdk UP-TO-DATE
:libcocos2dx:compileLint
:libcocos2dx:copyReleaseLint UP-TO-DATE
:libcocos2dx:mergeReleaseProguardFiles UP-TO-DATE
.........................
:libcocos2dx:packageReleaseJniLibs UP-TO-DATE
:libcocos2dx:packageReleaseLocalJar UP-TO-DATE
:libcocos2dx:packageReleaseRenderscript UP-TO-DATE
:libcocos2dx:bundleRelease UP-TO-DATE
:testCocos:checkDebugManifest
:testCocos:preReleaseBuild UP-TO-DATE
:testCocos:prepareProjAndroidLibcocos2dxUnspecifiedLibrary UP-TO-DATE
......................................
:testCocos:preDexDebug UP-TO-DATE
:testCocos:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/cocos2dx/lib/Cocos2dxAccelerometer;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':testCocos:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\ProgramFiles\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.sm5tudio.testCocos"
minSdkVersion 10
targetSdkVersion 21
ndk {
moduleName "cocos2dcpp_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main
{
jni.srcDirs = []
}
}
dependencies {
compile project(':libcocos2dx')
}

这里显示:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sm5tudio.testCocos"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" />
<application android:label="@string/app_name"
android:icon="@drawable/icon">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="cocos2dcpp" />
<activity android:name="org.cocos2dx.cpp.AppActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:anyDensity="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
&#13;
抱歉,我需要10个帖子来发布图片 这是我的库libcocos2dx和testCocos
的依赖关系
Cocos2dxlib
AndroidManifest.xml
lib
Cocos2dxAccelerometer
Cocos2dxActivity
Cocos2dxBitmap
Cocos2dxEditBoxDialog
Cocos2dxEditText
Cocos2dxGLSurfaceView
Cocos2dxHandler
Cocos2dxHelper
Cocos2dxLocalStorage
Cocos2dxLuaJavaBridge
Cocos2dxMusic
Cocos2dxRenderer
Cocos2dxSound
Cocos2dxTextInputWraper
Cocos2dxTypefaces
Cocos2dxVideoHelper
Cocos2dxVideoView
Cocos2dxWebView
Cocos2dxWebViewHelper
GameControllerAdapter
GameControllerDelegate
GameControllerUtils
testCocos
AndroidManifest.xml
cocos2dx
cpp
AppActivity
lib
build.gradle
build.gradle
build.gradle
settings.gradle
local.properties
&#13;