Open the project and create a package.json like this:
{
"name": "my-app",
"version": "1.0.0",
"description": "Sample package.json for running titanium apps within IntelliJ.",
"main": "index.js",
"directories": {},
"scripts": {
"setup": "./node_modules/.bin/titanium sdk install 8.3.1.GA --default",
"clean": "./node_modules/.bin/titanium clean",
"build": "npm run build:android && npm run build:ios",
"build:android": "./node_modules/.bin/titanium build -p android -b",
"build:android:full": "npm run build:android",
"build:ios": "./node_modules/.bin/titanium build -p ios -b",
"build:ios:full": "npm run build:ios",
"init:android": "npm install && npm run setup | $ANDROID_HOME/tools/bin/sdkmanager --licenses",
"init:ios": "npm install",
"android": "./node_modules/.bin/titanium build -p android -T emulator -C HUGO",
"ios": "./node_modules/.bin/titanium build -p ios -T simulator -C HUGO",
"download:android:sdk": "$ANDROID_HOME/tools/bin/sdkmanager \"platform-tools\" \"platforms;android-29\" \"build-tools;29.0.2\" \"emulator\" \"ndk-bundle\" \"system-images;android-29;google_apis_playstore;x86\"",
"create:avd": "echo \"no\"| $ANDROID_HOME/tools/bin/avdmanager create avd -f -n Pixel_2_API_28 -k \"system-images;android-29;google_apis_playstore;x86\" -d \"pixel\"",
"configure:avd": "for f in ~/.android/avd/*.avd/config.ini; do echo 'hw.keyboard=yes' >> \"$f\"; done",
"prepare:env:android": "npm install && npm-run-all init:android download:android:sdk create:avd configure:avd"
},
"author": "Andre Dvorak",
"license": "GPL",
"homepage": "https://www.kambrium.net",
"devDependencies": {
"npm-run-all": "4.1.5"
},
"dependencies": {
"alloy": "1.14.1",
"titanium": "5.2.1"
}
}
To start a device session with your new app just open the package.json an select
- "setup" target
- "android" target
After the build you will be asked you for the emulator of choice. You could skip this by replacing HUGO with the name of your favourite emulator.
No comments:
Post a Comment