Cocos2d-x Cocos2dxAccelerometer和Cocos2dxGLSurfaceView出错解决方案

【Cocos2dx】如何将CocosCreator构建发布的Android平台工程整合到已有的Android项目中 文章目录一,前言二,教程1. CocosCreator构建发布2. 导入libcocos2dx3.修改gradle配置3.复制jni文件夹4. 复制Activity5.编译运行6.出现的bug 一,前言 CocosCreator可以将开发的游戏发布到Android平台,使用Android Studio可以构建和运行编译目录下(frameworks\runtime-src\proj.android-studio)的工程。但其生成的工程比较复杂,当我们需要从一个已有的Android项目启动我们开发出的游戏时,整 阅读详情

转自:http://blog.youkuaiyun.com/wangyuchun_799/article/details/7761241


   最近使用最新版本的eclipse juno配置android开发cocos2dx,按照这篇文章(http://cn.cocos2d-x.org/bbs/forum.php?mod=viewthread&tid=882)进行配置后发现工程报cocos2d-x源文件报错,刚开始以为是cocos2d-x的一个bug,后面经过多方面查找资料测试,发现这并不是cocos2d-x的罪过(阿弥陀佛,cocos2d-x是很强大滴),是eclipse默认JDK版本的问题。默认eclipse(其他版本的eclipse可能也存在这个问题)将默认的JDK版本设置为JDK 5,事实上,cocos2d-x需要JDK 6以上的版本。所以解决方法就有了:

     

Eclipse -> Project -> Properties -> Java Compiler -> Compiler compliance level = 1.6


       现在cocos2d-x资料还不是特别丰富,出现问题可以到以下几个知名网站和论坛寻找答案:

cocos2d-x中文网站:http://cn.cocos2d-x.org/

cocos2d-x官网(英文):http://www.cocos2d-x.org/

cocos2d-x权威论坛(泰然论坛):http://article.ityran.com/


       遇到问题大家可以上泰然论坛求助,子龙山人等著名博客撰写人都在里面,这应该是cocos2d-x最好的论坛了。

MobaXterm破解14个会话限制的保姆级教程(附Python环境配置指南) 本文提供了MobaXterm破解14个会话限制的详细教程,并深入讲解了如何配置稳定的Python环境以支持相关脚本运行。通过理解软件授权机制、安全实践步骤以及许可文件的应用,帮助用户解除会话数量限制,实现高效的远程服务器管理与自动化运维。 阅读详情

相关推荐

用itext读取PDF文件提取对应得字符串

一.maven导入jar包 <!--pdf解析start--> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.10</version...

zhanghua_chinese的博客 3697

cocos2d-x插件开发常见异常汇总

问题1:执行cocos2d目录下的create-android-project.bat命令生成android项目失败? 解决:根据提示,可以知道是你输入的项目目录和项目名称错误。这个错误初学者容易遇到,请按照提示的格式输入你的命名。 问题2:publish插件时,报 “Compile failed; see the compiler error output for details”(

点滴成长 1159

2.1 SRv6 TE Policy

SRv6 TE Policy是在SRv6技术基础上发展的一种新的隧道引流技术。SRv6 TE Policy路径表示为指定路径的段列表(Segment List),称为SID列表(Segment ID List)。每个SID列表是从源到目的地的端到端路径,并指示网络中的设备遵循指定的路径,而不是遵循IGP计算的最短路径。如果数据包被导入SRv6 TE Policy中,SID列表由头端添加到数据包上,网络的其余设备执行SID列表中嵌入的指令。

m0_70976024的博客 1237

安卓:Cocos2dxActivity cannot be resolved to a type

把 cocos2d\cocos\platform\android\java\src 目录下的文件拷到 工程 目录下的 \proj.android\src 目录下

Valiancer 523

我爬取了某非法网贷后台系统数据,终于知道什么叫做利滚利滚利滚利了

我爬取了非法贷款的后台网站!

weixin_44042821的博客 2879

逆向学习:从已上线微信小游戏反推Cocos工程结构(以切水果跑酷为例)

本文以“切水果跑酷”为例,详细介绍了如何通过逆向分析已上线的微信小游戏,反推其基于Cocos Creator的原始工程结构。文章深入拆解了编译后的目录骨架、资源加载逻辑与依赖关系,并重点解析了微信平台API的调用特征,为开发者提供了一种高效学习游戏架构与设计模式的实用方法。

kk1234的博客 1072

【Cocos2d-x】Cocos2d-x参考案例源码解析之一:Cocos2dx各个文件说明

这里本人电脑配置是win7 64位,cocos2d-x2.20,VS2012 1:首先当然是下载cocos2d-x啦。我采用的是2.20版本【说明:2.14以后的版本和之前的VS模板生成和环境配置不一样】  点这里下载Cocos2d-X:http://www.cocos2d-x.org/download 解压然后你会得到如下图 然后运行:build-win32.ba

I am Leon - 产品 3741

GPS卫星轨道的理论和计算笔记分享

广义相对论预测,对比在时空弯曲度较大的地面上的原子钟,运行于时空弯曲度较小的卫星原子钟在地面上看起来更快,每天快约45us;反过来,当电压施加在晶体上时,晶体形状会扭曲(比如说伸长),而当晶体被施加上反向电压后,它将做相反的变形运动(比如缩短)。X轴:指向参考子午面与地球赤道的一个交点;从北黄极上方观察,地球北极在空间的运动轨迹是一个近似于以北黄极为中心的顺时针方向旋转的圆周,圆周半径等于。从上万年周期看,地球北极绕北黄极做大圆周运动,而从几年的短期来看,北极又在某一点处做局部的小幅椭圆运动。

m0_57139844的博客 2003

cocos2d框架的初步分析

cocos2d框架的初步分析 一  cocos2d框架的基础部分 cocos2D主要是基于GLSurfaceView实现的,它是cocos2d架构的基础。下面就GLSurfaceView的实现进行一个分析。 1  GLSurfaceView实现机制分析 GLSurfaceView是cocos2d里一个很重要的类,它负责创建render thread(即GLThread),处理事件(例如Ke

imyfriend的专栏 8536

基于 YOLOv26 的 PCB 板缺陷检测:工业级视觉实战

本文提出了一种基于YOLOv26的PCB板缺陷检测系统,通过深度学习技术实现对PCB板缺陷的自动化检测。系统能够识别短路、开路、焊点不良等8种常见缺陷,具有高精度、多类别分类和实时推理等优势。文章详细介绍了系统架构,包括数据采集、预处理、YOLOv26模型检测和后处理模块。在代码实现部分,给出了环境配置、数据预处理与增强的具体方法,使用Albumentations库进行图像增强处理。该系统为电子制造业提供了高效、准确的PCB质量检测解决方案,显著提升了检测效率和准确性。

一键难忘的博客 337

基于STM32L4XX、HAL库的 TMC2660C-PA 驱动程序设计

/ 默认灵敏度和电流。// 20/31最大电流。

zhusl6688的博客 384

cocos2dx打包异常处理记录

打包异常处理记录   1.通常情况下用cocos2d3.10新建的C++项目有二种,一种是预编译的一种是源代码的,预编译的项目只需要把项目中的proj.android导入到Eclipse中就可以直接打包了。   2.第二种是源代码的情况,这种情况下建立的项目如果直接导入到Eclipse中项目是会报错的,具体的报错地方是: 遇到这种情况不要激动,报错的原因是因为项目的属性中没有

pyf_914406232的博客 523

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Cocos2d-x java 通过jni调用c++的方法

前面博客说到,cocos2d-x c++界面层运行在一个GLThread线程里面,严格的说是运行在Cocos2dxGLSurfaceView(继承自GLSurfaceView) 里面。opengl的渲染,刷新都是有这个类来完成。 所以我们不能直接在java方法里调用c++方法来刷新界面,唯一的方法就是绕开javaUI主线程,让GLSurfaceView来做这件工作。 ok,前面说到...

weixin_30699465的博客 214

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

cocos2d-x android加速度监听导致崩溃问题

因为需要用到手机摇一摇的功能,所以需要监听加速度变化,并把变化传到上层(LUA)。在CCLayer添加LUA回调函数,在didAccelerate里面调用CCScriptEngineManager,调用LUA注册函数。问题出现,在win32和IOS上运作正常,在android上回调一会就会崩溃,如果不回调LUA HANDLER则 没问题,应该是android的某些问题导致lua内存错误。

tangkaiqi的专栏 1628

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

cocos2dx android平台事件系统解析

对于cocos2dx在android平台事件的响应过程很模糊,于是分析了下源码,cocos2dx 版本3.4,先导入一个android工程,然后看下AndroidManifest.xml &lt;application android:label="@string/app_name" android:icon="@drawable/icon"&gt...

linuxheik的专栏 415

cocos2d-x游戏开发(四)游戏主循环

欢迎转载:http://blog.youkuaiyun.com/fylz1125/article/details/8518737 终于抽时间把这个游戏写完了。由于没有自拍神器,所以把它移植到了Android上,用我的戴妃跑的很欢啊。自此,我算是完成了一个功能比较完善的游戏了。 麻雀虽小,五脏俱全,该有的都有,不该有的估计也有,嘿嘿。这几天把写这个游戏的经历和学习过程整理一下,多写几篇博客,就当做记笔记...

移动开发记录 335

Cocos2dx源码赏析(1)之启动流程与主循环

Cocos2dx源码赏析(1)之启动流程与主循环 Cocos2dx源码赏析(1)之启动流程与主循环 我们知道Cocos2dx是一款开源的跨平台游戏引擎,而学习开源项目一个较实用的办法就是读源码。所谓,“源码之前,了无秘密”。而笔者从事的也是游戏开发工作,因此,通过梳理下源码的脉络,来加深对Cocos2dx游戏引擎的理解。 既然,Cocos2dx...

weixin_34268843的博客 372

coco2d-x学习之程序入口

coco2d-x称之为跨平台,但它跟Java的跨平台是两个概念。与其说是跨平台,不如说是各平台对Opengl ES的支持。如果平台不支持Opengl ES,我真不知道怎么来移植了。 cocos2d-x在各平台的实现代码完全一致,你的工程只需要针对各平台做些配置工作即可,这点cocos2d-x的源码通过脚本都做好了。 cocos2d-x是怎么跟各个平台入口联系起来的呢,我仔细看了下代码,分...

移动开发记录 291

Cocos2dx GL SurfaceView截屏 应用层实现

问题:

Fly_7_Higher的专栏 2822

android cocos2dx,Cocos2dx 对android支持原理

Cocos2dx 基于opengl es 实现跨平台功能,虽然android 已经支持native ,还是需要使用到android平台中的特性。首先从程序的主入口MainActivity MainActivity跟进,java首先加载static函数,将libgame.so导入进来,根据activity的生命周期,首先调用oncreate()方法,由于继承Cocos2dxActivity类将调用该...

weixin_32818587的博客 518

Cocos2d-x之testCpp---Accelerometer(重力感应)分析

决定好好总结下testCpp里面的知识,这里我把testCpp中AccelerometerTest剥离出来了,总结下~ 我用的最新版的2dx。。。。cocos2d-2.1rc0-x-2.1.3   ndk是android-ndk-r8d class文件下载地址:http://download.youkuaiyun.com/detail/bill_ming/5568563 #include "Hel

以现在的努力程度之低,谈狗屁的未来,屎的梦想!!! 5881

cocos2dx 点击事件分析(2)

1、java端 Cocos2dxGLSurfaceView类 @Override public boolean onTouchEvent(final MotionEvent pMotionEvent) { // these data are used in ACTION_MOVE and ACTION_CANCEL ** final int pointerNumber = pMotion

思考的智慧,知识源于思考 1646

cocos2d-x android平台切入后台纹理失效的解决方法

android系统下,切入后台,则纹理全部失效,从后台切到前台,cocos2d-x会重新加载纹理。这样有两个问题: 1、如果纹理较多的话,加载纹理会卡很长时间,就像死机一样。 变通解决方法是修改引擎代码,增加一个进度条提示。 2、文字描边等用到RenderTexture的地方会出现异常纹理,文字会花掉。 暂时不知道原因,无解。 这里提供一个解决方案,解决掉纹理失效的问题,初步测试没有发现...

各研发管理 437

android activity切换慢,解决cocos2d-x和android activity互相调用时切换慢的问题

cocos2d-x 编译 android 应用,生成的 activity 继承自 Cocos2dxActivity,如果在应用中启用一个新的 java 的 activity,并且在两个 activity 之间切换,那么从 java 的 acitivity 切回来的时候会比较慢原因:从 log 中可以看到,切回 cocos2dx 的acitvity 的时候 openglES 会重新加载所有的 Tex...

weixin_42360778的博客 422

Cocos 游戏 微信授权登录 回来之后页面黑屏

解决微信登录等跨APP交互,COCOS游戏黑屏问题.

凌云志 1329
上一篇: VS2008报错LINK:fatal error LNK1000: Internal error during IncrBuildImage
下一篇: Win7 64x 新建Cocos2d-x Android项目
wangbofei
博客等级 码龄24年 33粉丝 33原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值