Require failed on android build

Require failed on android build
0

#1

Hi everyone,

I am trying to build an app with Cocos Creator.
When I test my project with the simulator, everything works fine.
But when I build the apk and run it on an emulator or a phone, I am only getting a blackscreen. The logcat tells me that ‘require’ has thrown an error because one of my scripts couldn’t be found.
Does the project needs to follow a certain structure for the scripts to be found?

Thanks in advance,
here is the complete stacktrace which was shown by logcat:

03-12 12:02:17.244  7403  7420 E jswrapper: [ERROR] Failed to invoke require, location: D:/Dokumente/Cocos2D/WhammyChat/build/android/110/22/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/proj.android/../manual/jsb_global.cpp:231
03-12 12:02:17.245  7403  7420 E jswrapper: ERROR: Uncaught Error: Cannot find module 'CustomSettings.js', location: src/project.js:0:0
03-12 12:02:17.245  7403  7420 E jswrapper: STACK: 
03-12 12:02:17.245  7403  7420 E jswrapper: [0]n@src/project.js:11 
03-12 12:02:17.245  7403  7420 E jswrapper: [1]anonymous@src/project.js:18  
03-12 12:02:17.245  7403  7420 E jswrapper: [2]__require.ChatLoader.ColorPalette@src/project.js:803  
03-12 12:02:17.245  7403  7420 E jswrapper: [3]n@src/project.js:17 
03-12 12:02:17.245  7403  7420 E jswrapper: [4]e@src/project.js:23  
03-12 12:02:17.245  7403  7420 E jswrapper: [5]anonymous@src/project.js:25 
03-12 12:02:17.245  7403  7420 E jswrapper: [6]s@src/jsb_polyfill.js:10  
03-12 12:02:17.245  7403  7420 E jswrapper: [7]anonymous@src/jsb_polyfill.js:21 
03-12 12:02:17.245  7403  7420 E jswrapper: [8]o@src/jsb_polyfill.js:19482  
03-12 12:02:17.245  7403  7420 E jswrapper: [9]83.y.handle@src/jsb_polyfill.js:9686  
03-12 12:02:17.245  7403  7420 E jswrapper: [10]r@src/jsb_polyfill.js:10223 
03-12 12:02:17.245  7403  7420 E jswrapper: [11]r@src/jsb_polyfill.js:10241 
03-12 12:02:17.245  7403  7420 E jswrapper: [12]89.c.flowIn@src/jsb_polyfill.js:10289
03-12 12:02:17.245  7403  7420 E jswrapper: [13]86.m.append@src/jsb_polyfill.js:9991 
03-12 12:02:17.245  7403  7420 E jswrapper: [14]79.C.load@src/jsb_polyfill.js:9104 
03-12 12:02:17.245  7403  7420 E jswrapper: [15]prepare@src/jsb_polyfill.js:19209
03-12 12:02:17.245  7403  7420 E jswrapper: [16]run@src/jsb_polyfill.js:19226  
03-12 12:02:17.245  7403  7420 E jswrapper: [17]boot@main.js:187  
03-12 12:02:17.245  7403  7420 E jswrapper: [18]anonymous@main.js:215
03-12 12:02:17.245  7403  7420 E jswrapper: [19]anonymous@main.js:239  

#2

I also had a black screen at build time if I had an error in my script You need to fix that part. Try Developer -> Compile User Script from the menu


#3

So for me it worked when I changed the template to binary (note: I am using v1.10.2).
Still wondering why it only works on binary though.