appcelerator titanium_prep.macos Android module build failure on Mac OSX - android

I am attempting to build a CommonJS module in Appcelerator Studio.
Following this recipe:
File > New > New Mobile Module Project
Set the project name to be testmodule
Leave the location as default
Set the Module Id to au.com.test.testmodule
Set the Titanium SDK Version to 5.3.1.GA
Set the Deployment Targets to Android
Click Next and then Finish
This will create a new module called testmodule.
Under this folder there is a one called assets, create a new file in there called au.com.test.testmodule.js. This will mark the module as a CommonJS module.
In this file just create an empty function and export it
function test() {
Ti.API.debug('test');
}
module.exports = test;
From the command line type:
ant
This will attempt to build the module.
In output you will see the ant target js.compile and this will have an error message
[exec] [DEBUG] "/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA/android/titanium_prep.macos" au.com.example.testmodule /testmodule/android/build/generated/js au.com.example.testmodule.js
[exec] [ERROR] Not enough arguments.
[exec] [ERROR] Unabled to prepare JavaScript for packaging. Error code 1.
[exec] Result: 1
Running ant like the following:
ant -debug -logfile build.log
The problem seems to be an executable called titanium_prep.macos.
If you run the command
"/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA/android/titanium_prep.macos" au.com.example.testmodule /testmodule/android/build/generated/js au.com.mobilogica.testmodule.js
It will give the error Not enough arguments. If you add one more parameter of anything, it will run without giving that message.
Of course being that the parameter is bogus, it will not generate the correct code.
It seems like titanium_prep.macos requires 4 parameters, but right now only three are being passed in.
au.com.example.testmodule
/testmodule/android/build/generated/js
au.com.example.testmodule.js
System:
Mac OSX 10.10.5
XCode 6.1
Appcelerator CLI 5.4.0
Appcelerator SDK 5.3.1
If you generate the example same module with 3.5.1.GA it works.
I have tried this in the 4.4 series of SDKs as well and have the same problem.

Related

Cordova GLOBAL is not defined when running on Android

I have setup a Cordova app with react following this tutorial.
When I try to run it on a physical android device using cordova run android -- --livereload The app is not compiled and not sent to the device, the only output I get is:
cordova run android -- --livereload
Successfully built!
GLOBAL is not defined
This is the verbose output of the command:
GLOBAL is not defined
ReferenceError: GLOBAL is not defined
at Object.isLiveReloadActivated (/Users/ivan/Desktop/MasterThesis/Test2/cordovaReact/plugins/cordova-plugin-livereload/lib/utils/helpers.js:94:5)
at Object.module.exports.isLiveReloadActive (/Users/ivan/Desktop/MasterThesis/Test2/cordovaReact/plugins/cordova-plugin-livereload/lib/index.js:21:17)
at module.exports (/Users/ivan/Desktop/MasterThesis/Test2/cordovaReact/plugins/cordova-plugin-livereload/lib/postEmulateRunHook.js:19:13)
at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:32)
at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:136:12)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:108:40
at processTicksAndRejections (internal/process/task_queues.js:95:5)
What is GLOBAL and how can I fix this error in order to get my app to compile and live reload?
Add this to your index.html file
<script>const global = globalThis;</script>

Delphi 11: Find correct toolsversion for MSBuild programmatically

We're upgrading to Delphi 11.1 from 10.4.
We have a few scripts which build and deploy Android projects. They assemble an msbuild command that looked like this:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore
With 11.1, this throws an error message:
C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\CodeGear.Common.Targets(940,7): error MSB4036: The "XmlPeek" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.0.50727" directory. [someproject.dproj]
Now, C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat, which is used by all of our build scripts, explicitly sets the .NET framework as below:
#SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v4.0.30319
#SET FrameworkVersion=v4.5
After some research, I hit on the idea of adding a toolsversion parameter to the msbuild command as below, and this worked:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore /toolsversion:4.0
This is all well and good, but I would prefer not to hard-code the toolsversion number in the script(s).
Is there a way I can programmatically obtain the correct value of the toolsversion that Delphi itself is using when it generates builds, etc.?
I assume that just finding the highest .NET version installed will not suffice (and even then, one has to "translate" that to a toolsversion). It has to marry up with whatever Delphi is doing (e.g., in the CodeGear.Common.Targets file referenced in the original error message).
This is a bug in Delphi 11.1 that has at least 3 bug reports: RSP-37855, RSP-38466, and RSP-38467.
You can add /tv:4.0 to your MSBuild command line, or modify the first line in the .dproj file to:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Build">
Assuming that rsvars.bat has been run,
FOR %%v IN ("%frameworkdir%") DO SET "toolsversion=%%~nv"
ECHO msbuild ...blah... /toolsversion:%toolsversion:~1%
The variable frameworkdir will be set by rsvars.bat. The for command parses its value (eg. C:\Windows\Microsoft.NET\Framework\v4.0.30319 as though it is a filename, and picks v4.0 as the "filename" (~n modifier [filename] of the metavariable %%v)
Then use the value assigned to toolsversion, starting at character 1 (where the first character is "character 0")
--- Given more info in comment
FOR %%v IN ("%frameworkdir%") DO ECHO %%~nxv|FINDSTR /R ".*\..*\.">nul&IF ERRORLEVEL 1 (SET "toolsversion=%%~nxv") ELSE SET "toolsversion=%%~nv"
Oh ye of little faith :)

Jenkins hanged when I try to build Unity project

I found Jenkins(windows) hanged when I try to build Unity project for android package.
I'm trying to use Jenkins with Unity plugin and windows bat to build project, after windows exe exported successful, android package exported failed.
The arguemnt when I use Unity plugin is
-batchmode -quit -projectPath "D:\Program Files (x86)\Jenkins\jobs\UnityJenkinsTest\workspace\QBAD" -executeMethod QBADBuildScript.Android -logFile "${WORKSPACE}/Build-Log.txt"
Meanwhile, I try using a windows bat to execute the same command from Jenkins, the result is the same.
"D:\Program Files\Unity\Editor\Unity.exe" -batchmode -quit -projectPath "D:\Program Files (x86)\Jenkins\jobs\UnityJenkinsTest\workspace\QBAD" -executeMethod QBADBuildScript.Android -logFile "${WORKSPACE}/Build-Log.txt"
When the building process went to the some part of build process, it hanged, and the build of jenkins never ended. I check with succeed log, it hanged before entering the part of Android.
(succeed log)
Used Assets, sorted by uncompressed size:
....
AndroidSDKTools: // This line and below never showed when hanging happened.
root : D:/Android/sdk
tools : D:/Android/sdk\tools
platform-tools: D:/Android/sdk\platform-tools
build-tools : D:\Android\sdk\build-tools\23.0.1
On the contrary, when I call the same script from command console of windows, it ended and succeed. I wonder what went wrong. Maybe I need set up environment variable for Jenkins.
The version of my Jenkins is 1.614, the version of my Unity is 5.0.1 .
Thanks
public static class AndroidSDKFolder
{
public static string Path
{
get { return EditorPrefs.GetString("AndroidSdkRoot"); }
set { EditorPrefs.SetString("AndroidSdkRoot", value); }
}
}
http://answers.unity3d.com/questions/495735/setting-android-sdk-path-in-environment-variable.html <-- This should help, setting the android sdk path stops the hang.

How to rename(branding) browser built on Android Chromium source code?

I need to build custom browser based on android chromium with custom product name.
I found config files(src/chrome/app/theme/chromium/BRANDING) and changed PRODUCT_FULLNAME.
Then I have built APK with commands
src$ gclient sync
src$ ninja -C out/Release chrome_public_apk
in console.
Build completes without errors.
But after installation on target device, I saw default product name.
Configurations in src/build/common.gypi:
'branding%' : 'Chromium'
'buildtype%' : 'Dev'
'component%' : 'static_library'
chromium.gyp_env: { 'GYP_DEFINES': 'OS=android' }
What i do wrong? How rebrand chromium?
that package name string is defined in //chrome/android/BUILD.gn.

Unity command line arguments for android and iOS

Please pardon my ignorance, relatively new to working with Unity3D. I am working on automating Unity3d builds from the command line.
I am looking for command line arguments to build apk & xcode project.
Unity's documentation does mention arguments to build a standalone Mac OSX player (-buildOSXPlayer) and a standalone Windows player (-buildWindowsPlayer) but not for android and iOS.
Any help would be really appreciated. Thanks.
Start with Unity's own documentation for command line builds for iOS and android.
For example, put this script in your Assets/Editor folder:
// C# example
using UnityEditor;
class Autobuilder
{
[MenuItem ("File/AutoBuilder/iOS")]
static void PerformBuild ()
{
string[] scenes = { "Assets/MyScene.unity" };
string buildPath = "../../../Build/iOS";
// Create build folder if not yet exists
Directory.CreateDirectory(buildPath);
BuildPipeline.BuildPlayer(scenes, buildPath, BuildTarget.iOS, BuildOptions.Development);
}
}
You can actually run this script in the Unity application by going to File -> Autobuilder -> iOS
To run on command line, it looks something like this:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -executeMethod Autobuilder.PerformBuild -email me#email.com -password myPassword
Of course, you're going to want to check the debug log for any errors:
Mac OS X ~/Library/Logs/Unity/Editor.log
Windows XP C:\Documents and Settings\username\Local Settings\Application Data_\Unity\Editor\Editor.log
Windows Vista/7 C:\Users\username\AppData\Local\Unity\Editor\Editor.log
The -executeMethod command line parameter is a very simple option to invoke any function in any of your scripts - which you can then use to do pretty much anything, including firing off an Android build.

Categories

Resources