当cocos 2d-x-3.15.1项目在android studio中编译时发生错误

时间:2017-07-05 11:10:13

标签: compiler-errors cocos2d-x-3.0

不知道如何解决cocos 2d-x-3.15.1的这个问题

 Warning:android-validator: Suspicious module dependency proj.android -> android: Android application module depends on other application module. Possibly, you should change type of module 'android' to 'Library' or change the dependency scope to 'Provided'.
    Error:Android Pre Dex: [EngineDataManager.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:139)
    Error:Android Pre Dex: [EngineDataManager.jar] Exception in thread "main" java.lang.NullPointerException
    Error:Android Pre Dex: [EngineDataManager.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:336)
    Error:Android Pre Dex: [EngineDataManager.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.loadDex(AndroidDxRunner.java:80)
    Error:Android Pre Dex: [EngineDataManager.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:136)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.security.AccessController.doPrivileged(Native Method)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    Error:Android Pre Dex: [EngineDataManager.jar] at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    Error:Android Pre Dex: [EngineDataManager.jar] Failed to load dx.jar
    Error:Android Pre Dex: [EngineDataManager.jar] java.lang.ClassNotFoundException: com.android.dx.command.DxConsole

安装android studio 2.3.3仍然显示这个错误与android studio 2.1.1相同。我不明白它的问题是什么..请帮帮我!!

Error:Android Pre Dex: [httpclient-4.4.1.1.jar] Failed to load dx.jar
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:139)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] Exception in thread "main" java.lang.NullPointerException
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:336)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:136)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.loadDex(AndroidDxRunner.java:80)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
Error:Android Pre Dex: [httpclient-4.4.1.1.jar] java.lang.ClassNotFoundException: com.android.dx.command.DxConsole



Error Occur at the time of Compiling the project in android studio. Its showing some dx.jar file error and some error which are unable to understand it. So please help me out from this error!





Error:Android Pre Dex: [annotations.jar] at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
        Error:Android Pre Dex: [annotations.jar] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        Information:05/07/2017 12:24 PM - Compilation completed with 13 errors and 0 warnings in 5s 253ms
        Error:Android Pre Dex: [annotations.jar] Failed to load dx.jar
        Error:Android Pre Dex: [annotations.jar] at java.security.AccessController.doPrivileged(Native Method)
        Error:Android Pre Dex: [annotations.jar] java.lang.ClassNotFoundException: com.android.dx.command.DxConsole
        Error:Android Pre Dex: [annotations.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        Error:Android Pre Dex: [annotations.jar] at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        Error:Android Pre Dex: [annotations.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.loadDex(AndroidDxRunner.java:80)
        Error:Android Pre Dex: [annotations.jar] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        Error:Android Pre Dex: [annotations.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:136)
        Error:Android Pre Dex: [annotations.jar] Exception in thread "main" java.lang.NullPointerException
        Error:Android Pre Dex: [annotations.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:336)
        Error:Android Pre Dex: [annotations.jar] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:139)
        Information:java: Some input files use unchecked or unsafe operations.
        Information:java: Recompile with -Xlint:unchecked for details.
        G:\Kunal\Gaming\cocos2d\cocos\platform\android\java\src\org\cocos2dx\lib\Cocos2dxSound.java

1 个答案:

答案 0 :(得分:0)

我有同样的问题。 遵循this解决方案并且工作了!

该解决方案适用于Ubuntu和OSX,但我相信它也适用于Windows。