我使用cocos new 命令新建一个项目 之后用android studio导入
运营起来之后报错
麻烦大神给讲解讲解,感激不尽!!!
比如:
cocos new demo3 -p com.wa.edu.test.demo3 -l cpp -d ./
用的 cocos 版本是什么,导入的哪个文件夹
先参考一下这个,先直接导入 cpp-tests 测试一下环境组件全不全
http://cocos2d-x.org/docs/cocos2d-x/zh/installation/Android-Studio.html
谢谢了 我的版本是3.16 倒入选择的时候 用的是 demo1这个文件夹 剩下就全是下一步了
我会先看看你给的链接,具体啥情况 ,后续我再写出来
我估计也是我平台搭建的问题,因为我在mac上没玩的很正常,现在玩android就有点尴尬了
看下 SDK tools 组件都下载更新了没,重新先试下 3.16 自带的test项目
我今天试过了 我用android studio去 导入 CppTests 项目
结果还是起不来
Error:Execution failed for task ‘:CppTests:externalNativeBuildDebug’.
Unexpected native build target cpp_tests. Valid values are:
感觉好像是 ndk的问题
我本地的ndk是 android-ndk-r14b
是不是 cocos3.16对这个ndk版本有要求啊
这个具体的 版本限制 我应该在哪里能看到呢?
http://www.cocos2d-x.org/docs/cocos2d-x/zh/installation/
http://www.cocos2d-x.org/docs/cocos2d-x/en/installation/prerequisites.html
3.16 对 r14 是没问题的
。。。。那就尴尬了 整一个星期了都
mac玩的刚刚的
谁知道android就歇菜了,唉 继续努力吧
晚点换着eclipse试试看吧
eclipse 已经被谷歌弃用了,3.16也弃用了Android 的 Eclipse 工程。
试着把sdk tools 的东西都更新一下,把全部的编译日志贴一下。
GitHub 最新的代码有更新一些 Android Studio 编译失败的问题, 你 Android Studio 版本是什么?
Android Studio 3.0.1
Build #AI-171.4443003, built on November 10, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1
Executing tasks: [:CppTests:assembleDebug]
Configuration ‘compile’ in project ‘:CppTests’ is deprecated. Use ‘implementation’ instead.
AGPBI: {“kind”:“warning”,“text”:“Targeted device ABI or comma-delimited ABIs [x86] is not one of [armeabi]. Nothing to build.”,“sources”:[{},{}]}
Configuration ‘compile’ in project ‘:libcocos2dx’ is deprecated. Use ‘implementation’ instead.
:CppTests:buildInfoDebugLoader
:CppTests:preBuild UP-TO-DATE
:libcocos2dx:preBuild UP-TO-DATE
:libcocos2dx:preDebugBuild UP-TO-DATE
:libcocos2dx:checkDebugManifest UP-TO-DATE
:libcocos2dx:processDebugManifest UP-TO-DATE
:CppTests:preDebugBuild UP-TO-DATE
:libcocos2dx:compileDebugAidl UP-TO-DATE
:CppTests:compileDebugAidl UP-TO-DATE
:libcocos2dx:packageDebugRenderscript NO-SOURCE
:CppTests:compileDebugRenderscript UP-TO-DATE
:CppTests:checkDebugManifest UP-TO-DATE
:CppTests:generateDebugBuildConfig UP-TO-DATE
:CppTests:prepareLintJar UP-TO-DATE
:CppTests:generateDebugResValues UP-TO-DATE
:CppTests:generateDebugResources UP-TO-DATE
:libcocos2dx:compileDebugRenderscript UP-TO-DATE
:libcocos2dx:generateDebugResValues UP-TO-DATE
:libcocos2dx:generateDebugResources UP-TO-DATE
:libcocos2dx:packageDebugResources UP-TO-DATE
:CppTests:mergeDebugResources UP-TO-DATE
:CppTests:createDebugCompatibleScreenManifests UP-TO-DATE
:CppTests:processDebugManifest UP-TO-DATE
:CppTests:splitsDiscoveryTaskDebug UP-TO-DATE
:libcocos2dx:platformAttrExtractor UP-TO-DATE
:libcocos2dx:processDebugResources UP-TO-DATE
:CppTests:processDebugResources UP-TO-DATE
:CppTests:generateDebugSources
:libcocos2dx:generateDebugBuildConfig UP-TO-DATE
:libcocos2dx:prepareLintJar UP-TO-DATE
:libcocos2dx:generateDebugSources UP-TO-DATE
:libcocos2dx:javaPreCompileDebug UP-TO-DATE
:libcocos2dx:compileDebugJavaWithJavac UP-TO-DATE
:libcocos2dx:processDebugJavaRes NO-SOURCE
:libcocos2dx:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:CppTests:javaPreCompileDebug UP-TO-DATE
:CppTests:compileDebugJavaWithJavac UP-TO-DATE
:CppTests:mergeDebugShaders UP-TO-DATE
:CppTests:compileDebugShaders UP-TO-DATE
:CppTests:generateDebugAssets UP-TO-DATE
:libcocos2dx:mergeDebugShaders UP-TO-DATE
:libcocos2dx:compileDebugShaders UP-TO-DATE
:libcocos2dx:generateDebugAssets UP-TO-DATE
:libcocos2dx:mergeDebugAssets UP-TO-DATE
:CppTests:mergeDebugAssets
:CppTests:packageInstantRunResourcesDebug UP-TO-DATE
:CppTests:checkManifestChangesDebug
:CppTests:transformClassesWithExtractJarsForDebug UP-TO-DATE
:CppTests:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE
:CppTests:transformClassesWithDependencyCheckerForDebug UP-TO-DATE
:CppTests:generateJsonModelDebug UP-TO-DATE
:CppTests:externalNativeBuildDebug FAILED
:CppTests:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:CppTests:externalNativeBuildDebug’.
Unexpected native build target cpp_tests. Valid values are:
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 6s
42 actionable tasks: 5 executed, 37 up-to-date
可能你手动指定的ndk有问题,试下 Android Studio 自带的 ndk 吧,直接更新,改下配置,再编译看看
太无奈了…

Executing tasks: [:CppTests:assembleDebug]
Configuration ‘compile’ in project ‘:CppTests’ is deprecated. Use ‘implementation’ instead.
AGPBI: {“kind”:“warning”,“text”:“Targeted device ABI or comma-delimited ABIs [x86] is not one of [armeabi]. Nothing to build.”,“sources”:[{},{}]}
Configuration ‘compile’ in project ‘:libcocos2dx’ is deprecated. Use ‘implementation’ instead.
:CppTests:buildInfoDebugLoader
:CppTests:preBuild UP-TO-DATE
:libcocos2dx:preBuild UP-TO-DATE
:libcocos2dx:preDebugBuild UP-TO-DATE
:libcocos2dx:checkDebugManifest UP-TO-DATE
:libcocos2dx:processDebugManifest UP-TO-DATE
:CppTests:preDebugBuild UP-TO-DATE
:libcocos2dx:compileDebugAidl UP-TO-DATE
:CppTests:compileDebugAidl UP-TO-DATE
:libcocos2dx:packageDebugRenderscript NO-SOURCE
:CppTests:compileDebugRenderscript UP-TO-DATE
:CppTests:checkDebugManifest UP-TO-DATE
:CppTests:generateDebugBuildConfig UP-TO-DATE
:CppTests:prepareLintJar UP-TO-DATE
:CppTests:generateDebugResValues UP-TO-DATE
:CppTests:generateDebugResources UP-TO-DATE
:libcocos2dx:compileDebugRenderscript UP-TO-DATE
:libcocos2dx:generateDebugResValues UP-TO-DATE
:libcocos2dx:generateDebugResources UP-TO-DATE
:libcocos2dx:packageDebugResources UP-TO-DATE
:CppTests:mergeDebugResources UP-TO-DATE
:CppTests:createDebugCompatibleScreenManifests UP-TO-DATE
:CppTests:processDebugManifest
:CppTests:splitsDiscoveryTaskDebug UP-TO-DATE
:libcocos2dx:platformAttrExtractor UP-TO-DATE
:libcocos2dx:processDebugResources
:CppTests:processDebugResources
:CppTests:generateDebugSources
:libcocos2dx:generateDebugBuildConfig UP-TO-DATE
:libcocos2dx:prepareLintJar UP-TO-DATE
:libcocos2dx:generateDebugSources
:libcocos2dx:javaPreCompileDebug UP-TO-DATE
:libcocos2dx:compileDebugJavaWithJavac UP-TO-DATE
:libcocos2dx:processDebugJavaRes NO-SOURCE
:libcocos2dx:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:CppTests:javaPreCompileDebug UP-TO-DATE
:CppTests:compileDebugJavaWithJavac UP-TO-DATE
:CppTests:mergeDebugShaders UP-TO-DATE
:CppTests:compileDebugShaders UP-TO-DATE
:CppTests:generateDebugAssets UP-TO-DATE
:libcocos2dx:mergeDebugShaders UP-TO-DATE
:libcocos2dx:compileDebugShaders UP-TO-DATE
:libcocos2dx:generateDebugAssets UP-TO-DATE
:libcocos2dx:mergeDebugAssets UP-TO-DATE
:CppTests:mergeDebugAssets
:CppTests:packageInstantRunResourcesDebug UP-TO-DATE
:CppTests:checkManifestChangesDebug
:CppTests:transformClassesWithExtractJarsForDebug UP-TO-DATE
:CppTests:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE
:CppTests:transformClassesWithDependencyCheckerForDebug UP-TO-DATE
:CppTests:generateJsonModelDebug
:CppTests:externalNativeBuildDebug FAILED
:CppTests:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:CppTests:externalNativeBuildDebug’.
Unexpected native build target cpp_tests. Valid values are:

最后 我只能认为是 这个android sdudio版本的问题了。。。
顺便问下 ,大家的项目都是用的什么ide 什么 版本 然后顺利跑起来地哇?
我打算去下一个 android studio的2.3.3的版本再继续试试看,希望有一个结果吧
测试 3.16 环境搭建的时候 3.01 还没出来,于是就用的 2.3.3,官方测试 3.16 也是这个版本。要是重新下的话,就把下的 cocos2d-x 压缩包也重新解压一下,保证一下配置文件也是新的
3.16 出来之后,我就直接用的GitHub最新的代码学习开发,这种方法稍微麻烦一点,详细看 GitHub 的 readme,最新代码就搭配最新的 Android Studio
http://forum.cocos.com/t/android-studio-lua/54535/5?u=2627993092
你是不是导入选错了。。。,应该选择 Import project(Eclipse ADT, Gradle, etc.)
没 选择的是对的
唉。换了版本还是一样的问题。
这两天忙着其他事儿,过两天再回来接着玩-_-}
这一晃就是4年,玩出来了嘛
问题解决了么?我也遇到了同样的问题




