从 1.4.2 升级到 1.5,有升级失败的同学来此帖报告吧

正是用了这个方法编译之后 版本回退也不行了 不知道什么原因

new cc.Sequence 这个1.5.4 有问题吗 这个在android 原生平台有遇到闪退

这问题偶尔才会出现, 没法做 test case 给你。
可是我帮你们分析了这问题。

问题处在 schedule 里,instanceId 用 getTargetId 拿到 undefined。

这 undefined 的 instanceId 用来领取 hashForTimers 里的 element。

默认用 undefined 来领取 hashForTimers 里的 element 为空,可是 hashForTimers 里 undefined 有了其他 element。

就因为这样 element 拿错了,接下来的 if (!element) 会跑到 cc.assert 。这莫名其妙的 element 的 paused 是 undefined, cc.assert 会失败。

1赞

无法引入第三方underscore.js

TypeError: Cannot read property ‘_’ of undefined
at file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:26048:32
at Object.require.underscore (assets/Src/Common/underscore.js:1416:1)
at s (file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:262)
at file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:313
at Object.require.log.Environment (assets/Src/Common/log.js:1)
at s (file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:262)
at file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:313
at Object.require.AudioManager.log (assets/Src/Common/AudioManager.js:1)
at s (file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:262)
at e (file:///Users/yanan/Desktop/818Client/library/bundle.project.js?001:1:433)

这个不能导入 underscore 不是 1.5 才有的问题吧?

安卓编译之后再AS打开编译报错,使用的模板是link,default模板编译不通过(报这个错:arm-linux-androideabi-g++: error: F:tutorial-blackjack-masterbuildjsb-defaultframeworkscocos2d-xexternal/android/armeabi-v7a/libjs_static.a: No such file or directory)
AS上面的日志
D:\software\CocosCreator1.5\resources\cocos2d-x\cocos\platform\CCPlatformConfig.h
Error:(143, 6) error: #error “Cannot recognize the target platform; are you targeting an unsupported platform?”

F:\tutorial-blackjack-master\build\jsb-link\frameworks\runtime-src\Classes\AppDelegate.h
Error:(18, 30) error: ‘cocos2d’ has not been declared
Error:(18, 39) error: expected ‘{’ before ‘Application’
Error:(19, 1) error: invalid type in declaration before ‘{’ token
Error:(20, 1) error: expected primary-expression before ‘public’
Error:(20, 1) error: expected ‘}’ before ‘public’
Error:(20, 1) error: expected ‘,’ or ‘;’ before ‘public’
Error:(22, 26) error: declaration of ‘~AppDelegate’ as non-member
Error:(24, 31) error: virt-specifiers in ‘initGLContextAttrs’ not allowed outside a class definition
Error:(31, 48) error: ‘virtual’ outside class declaration
Error:(37, 48) error: ‘virtual’ outside class declaration
Error:(43, 49) error: ‘virtual’ outside class declaration
Error:(44, 1) error: expected declaration before ‘}’ token
Error:(18, 30) error: ‘cocos2d’ has not been declared
Error:(18, 39) error: expected ‘{’ before ‘Application’
Error:(19, 1) error: invalid type in declaration before ‘{’ token
Error:(20, 1) error: expected primary-expression before ‘public’
Error:(20, 1) error: expected ‘}’ before ‘public’
Error:(20, 1) error: expected ‘,’ or ‘;’ before ‘public’
Error:(22, 26) error: declaration of ‘~AppDelegate’ as non-member
Error:(24, 31) error: virt-specifiers in ‘initGLContextAttrs’ not allowed outside a class definition
Error:(31, 48) error: ‘virtual’ outside class declaration
Error:(37, 48) error: ‘virtual’ outside class declaration
Error:(43, 49) error: ‘virtual’ outside class declaration
Error:(44, 1) error: expected declaration before ‘}’ token
Error:(18, 30) error: ‘cocos2d’ has not been declared
Error:(18, 39) error: expected ‘{’ before ‘Application’
Error:(19, 1) error: invalid type in declaration before ‘{’ token
Error:(20, 1) error: expected primary-expression before ‘public’
Error:(20, 1) error: expected ‘}’ before ‘public’
Error:(20, 1) error: expected ‘,’ or ‘;’ before ‘public’
Error:(22, 26) error: declaration of ‘~AppDelegate’ as non-member
Error:(24, 31) error: virt-specifiers in ‘initGLContextAttrs’ not allowed outside a class definition
Error:(31, 48) error: ‘virtual’ outside class declaration
Error:(37, 48) error: ‘virtual’ outside class declaration
Error:(43, 49) error: ‘virtual’ outside class declaration
Error:(44, 1) error: expected declaration before ‘}’ token
Error:(18, 30) error: ‘cocos2d’ has not been declared
Error:(18, 39) error: expected ‘{’ before ‘Application’
Error:(19, 1) error: invalid type in declaration before ‘{’ token
Error:(20, 1) error: expected primary-expression before ‘public’
Error:(20, 1) error: expected ‘}’ before ‘public’
Error:(20, 1) error: expected ‘,’ or ‘;’ before ‘public’
Error:(22, 26) error: declaration of ‘~AppDelegate’ as non-member
Error:(24, 31) error: virt-specifiers in ‘initGLContextAttrs’ not allowed outside a class definition
Error:(31, 48) error: ‘virtual’ outside class declaration
Error:(37, 48) error: ‘virtual’ outside class declaration
Error:(43, 49) error: ‘virtual’ outside class declaration
Error:(44, 1) error: expected declaration before ‘}’ token
之前1.4版本是没问题的

这个是由于项目所在路径过长导致的错误,在 Android Studio 里直接编译可以避免这个问题

AS里面直接编译也还是报这个错呀

这个问题后来怎么解决了,我也遇到了。

从 1.4.2 升级到 1.5,运行模拟器调试出现错误,1.4.2可以运行

Hi, 谢谢错误截图,问一下你们的 schedule 是不是有对非引擎对象调用??也就是说 schedule 调用时的 target 是非法的。

我会在这里增加一个更严格的校验,如果 getTargetId 为 undefined,会禁止添加 schedule,那么你那边应该会遇到报错,解决方法也不难,只要你对你的 target 做下面的操作:

target.__instanceId = cc.ClassManager.getNewInstanceId();

就可以正常 schedule 了

怎么解决

@panda 我们的 target 对象是个 cc.Object。请问 cc.Object 是非法 target 吗?

1.5版本打开项目一直显示加载的圆圈,下面报错
TypeError: children[i]._onBatchCreated is not a function
at cc_Scene._onBatchCreated (D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\CCNode.js:1090:25)
at cc_Scene._load (D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\CCScene.js:82:18)
at runSceneImmediate (D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\CCDirector.js:541:19)
at D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\CCDirector.js:801:34
at CCLoader. (D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\platform\CCAssetLibrary.js:101:17)
at D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\load-pipeline\CCLoader.js:227:34
at D:\xufei\软件\cocos creator1.5\CocosCreator\resources\engine\cocos2d\core\platform\utils.js:65:21
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
这是什么情况?

inspector 失败 怎么解决

1.4.0没问题,1.4.2有问题,现在1.5.0也有问题

cc.Object 的确不包含必要的 __instanceId 字段,需要用我说的方法附加上去

上传中…
我用的是1.5.1beta3 从1.4.2升级而来,报了这个错,是label preload加载ttf字体时报的错,我看了一下源码,是要启动检查ttf加载结束定时器之前,检测这个组件是否有开启过定时器,但检查时(isScheduled)时发现targetId为undefined,报了错,这不是引擎自己相互调用的么,怎么targetID也不存在

beta3 的这个问题会在下个版本修改,感谢反馈。

建议使用es6的 for of