i create a simple memory game with the last version of cocos code IDE(v1.2.0) and last version of cocos2d-JS(v3.3) and it work fine on the WEB and also work well when i debug it to an android simulator(BlueStack) and my android device, BUT when i have to debug it on BlueStack the following error appear in the IDE consol: JS: /data/data/org.cocos2dx.PrebuiltRuntimeJs/files/debugruntime/script/jsb_create_apis.js:910:Error: js_cocos2dx_LabelTTF_create : wrong number of arguments so i delete all argument for cc.LabelTTF.create except text, fontName, fontSize to debug the game correctly.
(source: cocos2d-x.org)
i get this alert box when i want to package to APK.(i clicked YES)
(source: cocos2d-x.org)
Now, after i get the APK file (result of package the game to apk), i get a black screen that show only the FPS on both BlueStack and my android device.
Note that when i package the default HelloWolrd project it works correctly without this problem.
(source: cocos2d-x.org)
i use the last version of ant(v1.9.4) and NDK r9d
also when i debug the apk file generated form package to apk option i just got this line in the console:
Start LaunchActivity org.example.concentration/org.cocos2dx.javascript.AppActivity
and the black screen with the FPS appear on the emulator and android device. so i can't see what happen.
i also check the content of build-cfg.json file and this why i get.
{
"ndk_module_path" :[
"../../js-bindings",
"../../js-bindings/cocos2d-x",
"../../js-bindings/cocos2d-x/cocos",
"../../js-bindings/cocos2d-x/external"
],
"copy_resources": [
{
"from": "../../../src",
"to": "src"
},
{
"from": "../../../res",
"to": "res"
},
{
"from": "../../../main.js",
"to": ""
}
],
"must_copy_resources": [
{
"from": "../../js-bindings/bindings/script",
"to": "script"
},
{
"from": "../../../config.json",
"to": ""
},
{
"from": "../../../project.json",
"to": ""
}
]
}
and when i unpacked the apk file i found the resources too.
(source: cocos2d-x.org)
the pictures are in the assets folder.
this is exactly the same structure as the default Hello World simple project created by cocos IDE.
(the only difference is that the default project work after packaging and my game doesn't!)
How can i solve this problem?
thanks in advance.
Related
I'm setting up my first hybrid app using cordova / framework7-cli....
all fine, except
cordova run android
freezes with:
"Reading build config file: C:\...\APP\build.json . . . . . . "
and many many more dots.
Tried to
1. cordova build android --release
2. Moved build.json, take a look inside, ok...
3. built a new apk, built a new session, tried another avd ...
build.json:
{
"ios": {
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"development": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
However, this freeze causes to break my build-process and nothing happens. normally i can see my app on the selected device...
Does anybody got the same issue?
If using Android Virtual Device make sure to run "Cold Boot Now". This fixed the issue for me
Currently I am using Flutter to build my application.
Background
I have followed some guide on building different environments entry files:
https://iirokrankka.com/2018/03/02/separating-build-environments/
which create main_dev.dart and main_prod.dart.
Also I have learnt to build flavor for both iOS and Android:
https://medium.com/#salvatoregiordanoo/flavoring-flutter-392aaa875f36
which now I can use --flavor <FLAVOR> in the command to build different flavor application.
Now I have encountered a problem when I try to combine two skills.
Target Result
Below is what I would like to achieve:
development flavor -> main_dev.dart entry file
production flavor -> main_prod.dart entry file
Problem Encounter
in iOS side, I can target the entry file in .xcconfig file like following:
// ios/Flutter/development.xcconfig
#include "Generated.xcconfig"
FLUTTER_TARGET=lib/main_dev.dart
I know I can add -t lib/main_dev.dart after flutter run command.
However I would like to ask if there is any solution to set
the flutter target file in Android side inside flavor config?
Appreciate for any help.
I would like to ask if there is any solution to set the flutter target
file in Android side inside flavor config?
I don't know the equal of FLUTTER_TARGET for Android flavor. I would to like to learn that too.
But, flutter run -t is not the only option here. When you open a Flutter project (the root project) with Android Studio you will have a default run/debug configuration like below:
When you click Edit Configurations below screen will appear:
There you can set Build flavor and Dart entrypoint. Obviously, you can create multiple configurations for each flavor.
Reference: https://cogitas.net/creating-flavors-of-a-flutter-app/
So, that's a solution for Flutter in Android Studio. For VSCode, I have a workaround. I'm using -t parameter. But I have it automated by VSCode. Under .vscode/launch.json I have configurations like below:
"configurations": [
{
"name": "GoodOne",
"request": "launch",
"type": "dart",
"args": ["--flavor",
"good",
"-t",
"./lib/main-good.dart"
]
},
{
"name": "BadOne",
"request": "launch",
"type": "dart",
"args": ["--flavor",
"bad",
"-t",
"./lib/main-bad.dart"
]
}
]
With this, you can run your flavors by just pressing F5 and choose your config at the upper-left corner.
Again, this is not an exact answer to OP's question, but some workarounds.
I am trying to compile a 'kitchen-sink' demo, for 'react-native':
NativeBase-KitchenSink
, and I have followed the following links already:
Solution to "React native: Android project not found. Maybe run react-native android first?"
Solution to "Expo : Cannot find a module LogReporter"
That is, from the installation of 'npm' till the installation of required tools using 'Yarn'.
And now I am stuck myself:
a. I run the command npm install in the 'root directory' of this project.
b. Then I run expo start, I see that the problems addressed in link 1 and 2 have gone away.
c. Then when the browser is up, I issue expo build:android
The following error shows up:
[11:14:44] Checking if current build exists...
[11:14:48] No currently active or previous builds for this project.
[11:14:50] Publishing to channel 'default'...
[11:14:56] Building iOS bundle
[11:15:09] Building Android bundle
[11:15:20] Analyzing assets
[11:15:27] Uploading assets
[11:15:27] No assets to upload, skipped.
[11:15:27] Processing asset bundle patterns:
[11:15:27] - D:\Projects\ReactNativeProjects\AwesomeProject\**\*
[11:15:27] Cannot read property 'forEach' of undefined
[11:15:27] TypeError: Cannot read property 'forEach' of undefined
at C:\xdl#51.4.0\src\Project.js:903:26
at Generator.next (<anonymous>)
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361
Please help me know where I am wrong? Some posts say the code is correct.
[EDIT]:
I also did a new thing in my 'app.json', just before executing command react-native eject, to create Android and iOS folders:
(Note: It is not mandatory to issue the react-native eject command, as this will cause permanent change according to the documentations)
{
"expo": {
"name": "AwesomeProject",
"description": "A Kitchen Sink project.",
"slug": "AwesomeProject",
"privacy": "public",
"sdkVersion": "30.0.0",
"platforms": [
"ios",
"android"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.abhsax.first"
},
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/logo.png",
"splash": {
"image": "./assets/splashscreen.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
]
},
"changes": "----below are the changes----",
"name": "AwesomeProject",
"displayName": "AwesomeProject"
}
That is, just when I added:
"name": "AwesomeProject",
"displayName": "AwesomeProject"
at the bottom of my 'app.json'
the command react-native eject started working, which was not working earlier, as the output was:
App name must be defined in the app.json config file to define the
project name. It must not contain any spaces or dashes.
Clearly, it is the hybrid of two different versions of the package managers: 'Expo' and 'npm'.
But the 'forEach' error in the concern here, did not go away.
Further efforts done were useless, so I am not putting them here.
I shall keep on trying until I figure it out.
you have to upgrade the expo cli version
do npm install -g expo-cli
and then expo start again
I resolved this by knowing that I was again mixing up with the package managers: 'npm' and 'yarn', and this time you do not need 'expo' for time being or all-together, so modify your 'app.json', removing expo section.
All I had to do was to issue the following commands in order.
Add React Base
yarn add react-base --save
Install Peer Dependencies
The peer dependencies included from any 'npm' packages does not automatically get installed. Your application will not depend on it explicitly.
react-native link
In the case of this demo project, one dependency was missing:
react-native link react-native-vector-icons
Start Yarn
yarn start
Run on android device or simulator.
react-native run-android
[Note:] Java 8 is recommended to be installed instead of higher versions of Java. see: What to install? Java 8 or Java 10
I wish it helps.
Happy coding :-)
Try changing:
"assetBundlePatterns": ["**/*"] to "assetBundlePatterns": ["assets/*"]
in your app.json file.
I face a weird Ionic2 behaviour.
When i deploy my app to a simulator, i can see the .ts file sourceMap in the chrome inspect debugger.
On both case, i use :
ionic run android
On the other side, when i deploy my apk on a real device, the tab "Sources" is completely different with an other groups of directories and, with no reference to my .ts files.
My environment is:
OS X 10.11
Ionic 2 2.0.0-beta.35
cordova 6.3.0
The project has been initially generated by:
ionic start biblio tutorial --v2
ionic.config.json
{
"name": "biblio",
"app_id": "",
"v2": true,
"typescript": true
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"filesGlob": [
"**/*.ts",
"!node_modules/**/*"
],
"exclude": [
"node_modules",
"typings/global",
"typings/global.d.ts"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
Any ideas?
For me the problem was that when you're remote debugging on an android device, Chrome debugger cannot access the source map file on the device. The solution/fix is to include the source map inline. To do this I:
added the below to package.json in the root project directory
"config": {
"ionic_bundler": "webpack",
"ionic_source_map_type": "#inline-source-map"
},
This is to make the webpack to add source maps inline changed tsconfig.js line
"sourceMap": true,
to
"sourceMap": false
This is to disable typescript to create source map file since this is done by webpack.
After this change everything seems to be working fine. Note that this applies to ionic 2 RC_04
I made the following steps to use Phonegap library with my app:
download phohegap-2.3.0 from http://phonegap.com/download/
copy cordova-2.3.0.js from phonegap-2.3.0/lib/android/ to the root
directory of my sencha touch 2 application
add the following to app.json in the root directory of my sencha
touch app:
{
"path": "cordova-2.3.0.js",
"update": "delta"
},
In the Chrome browser it works OK. But when I run the app on a real device (Android 2.3.0) it hangs forever on the first standart blinking screen.
Does anyone know - have I made all required steps to install Phonegap or there are some more ones?
Update
I had generated an empty application and it did not work with attached cordova.js (when the object was before attached sencha-touch.js).
It may be strange but the application loads normally when I place the strings with "cordova-...js" on the bottom of a "js" field (previously it was the first object in the "js" array):
"js": [
{
"path": "touch/sencha-touch.js"
},
{
"path": "app.js",
"bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */
"update": "delta"
},
{
"path": "cordova-2.2.0.js"
}
]...
However I am not sure that PhoneGap works properly. I will test it and will publish my result.