Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6820] Android: Build fails when Java keywords are used in project app id

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2012-03-14T10:06:09.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsAndroid
Labelsandroid, module_build, qe-and021312, qe-testadded
ReporterTony Lukasavage
AssigneeChase Culpepper
Created2011-12-21T11:31:40.000+0000
Updated2012-03-15T10:15:10.000+0000

Description

If you enter a Java keyword as the first part of your project's app id, it can cause Android build errors.

Steps to Reproduce

1. Create a new mobile project in Titanium Studio 2. give your project the app id *case.test* 3. make sure Android is selected as a deployment target 4. Create the project 5. Attempt to build the app You should get an error like this
[ERROR] Error(s) compiling generated Java code
[ERROR] /Users/tlukasavage/Documents/Titanium Studio Workspace/case_test/build/android/gen/case/test/ApplicationStylesheet.java:5: <identifier> expected
If you look at that line in the identified file, you'll find that *case* from *case.test* is the offender
/**
 * Appcelerator Titanium
 * WARNING: This is a generated file.  Do not modify.
 */
package case.test; // this is line 5

import java.util.HashMap;

Comments

  1. Paul Dowsett 2011-12-21

    To confirm that the same problem occurs when "package" is used as the app id. See build.log below. Please note that an app with a reserved word, such as "package", in its *project name* but with an app id that does not contain any reserved words, launches without an issue, despite what is stated in TIMOB-2554. Hence: * Project name: "package" // this packages successfully * App id: "com.appcelerator.package" // this breaks packaging
       Logfile initialized
       [INFO] logfile = /home/appcel/Titanium Studio Workspace/package/build.log
       [DEBUG] /home/appcel/.titanium/mobilesdk/linux/1.8.0.1.RC3/android/builder.py simulator package /opt/android-sdk-linux_86 /home/appcel/Titanium Studio Workspace/package com.appcelerator.package 4 WVGA854 
       [INFO] Building package for Android ... one moment
       [INFO] Titanium SDK version: 1.8.0.1 (12/17/11 19:53 c903964)
       [DEBUG] Waiting for device to be ready ...
       [TRACE] adb devices returned 1 devices/emulators
       [DEBUG] Device connected... (waited 0 seconds)
       [DEBUG] waited 0.003938 seconds on emulator to get ready
       [DEBUG] com.appcelerator.package installed? False
       [INFO] Fastdev server running, deploying in Fastdev mode
       [INFO] Copying project resources..
       [TRACE] Generating Java Classes
       [DEBUG] Processing Android resource drawables
       [DEBUG] copying app icon: /home/appcel/Titanium Studio Workspace/package/build/android/bin/assets/Resources/appicon.png
       [DEBUG] generating theme.xml
       [DEBUG] found drawable-notlong-land-hdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-hdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-hdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-land-hdpi/background.png
       [DEBUG] found drawable-notlong-land-ldpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-ldpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-ldpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-land-ldpi/background.png
       [DEBUG] found drawable-notlong-port-hdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-hdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-hdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-port-hdpi/background.png
       [DEBUG] found drawable-long-port-ldpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-port-ldpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-port-ldpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-long-port-ldpi/background.png
       [DEBUG] found drawable-long-land-ldpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-land-ldpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-land-ldpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-long-land-ldpi/background.png
       [DEBUG] found drawable-long-land-hdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-land-hdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-land-hdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-long-land-hdpi/background.png
       [DEBUG] found drawable-notlong-land-mdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-mdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-land-mdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-land-mdpi/background.png
       [DEBUG] found drawable-notlong-port-mdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-mdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-mdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-port-mdpi/background.png
       [DEBUG] found drawable-long-port-hdpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-port-hdpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-long-port-hdpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-long-port-hdpi/background.png
       [DEBUG] found drawable-notlong-port-ldpi splash screen at /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-ldpi/default.png
       [DEBUG] copying /home/appcel/Titanium Studio Workspace/package/Resources/android/images/res-notlong-port-ldpi/default.png splash screen to /home/appcel/Titanium Studio Workspace/package/build/android/res/drawable-notlong-port-ldpi/background.png
       [DEBUG] found splash screen at /home/appcel/Titanium Studio Workspace/package/build/android/bin/assets/Resources/default.png
       [TRACE] Writing out AndroidManifest.xml
       [DEBUG] adding /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageApplication.java to javac build list
       [DEBUG] adding /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageAppInfo.java to javac build list
       [DEBUG] adding /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/R.java to javac build list
       [DEBUG] adding /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageActivity.java to javac build list
       [DEBUG] adding /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/ApplicationStylesheet.java to javac build list
       [DEBUG] Building Java Sources: "/home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageApplication.java" "/home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageAppInfo.java" "/home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/R.java" "/home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageActivity.java" "/home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/ApplicationStylesheet.java"
       [ERROR] Error(s) compiling generated Java code
       [ERROR] /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageApplication.java:6: <identifier> expected
       package com.appcelerator.package;
                                ^
       /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageAppInfo.java:1: <identifier> expected
       package com.appcelerator.package;
                                ^
       /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/R.java:8: <identifier> expected
       package com.appcelerator.package;
                                ^
       /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/PackageActivity.java:1: <identifier> expected
       package com.appcelerator.package;
                                ^
       /home/appcel/Titanium Studio Workspace/package/build/android/gen/com/appcelerator/package/ApplicationStylesheet.java:5: <identifier> expected
       package com.appcelerator.package;
                                ^
       5 errors
       
  2. Tim Poulsen 2012-01-10

    I added a note to the wiki guides about not using Java keywords. https://wiki.appcelerator.org/display/guides/Hello+World
  3. Eric Merriman 2012-02-07

    Verified that using one of the keywords in the app ID will still cause the build to fail, but will warn: [ERROR] Do not use java keywords for project app id, such as case Checked with Titanium Studio, build: 1.0.8.201201262211 and SDK 1.9.0.v20120207000134
  4. Dustin Hyde 2012-02-16

    Re-opening as conditionally Not Fixed. App ID values containing: true, false, and null exhibit the old behavior. Log: --- [ERROR] Error(s) compiling generated Java code [ERROR] /Users/dhyde/Documents/Titanium Studio Workspace/null/build/android/gen/com/appcelerator/true/ApplicationStylesheet.java:5: expected package com.appcelerator.true; ^ --- Some Java operators do not generate specific character warnings (such as '<'). Log: --- [ERROR] /Users/dhyde/Documents/Titanium Studio Workspace/null/build/android/AndroidManifest.xml:3: error: Error parsing XML: not well-formed (invalid token) [ERROR] Error generating R.java from manifest --- SDK: 1.8.2.v20120214163156, 1.8.1 Android: V8 Studio: 1.0.9.201202131024 OS: Lion Devices Tested: Android Emulator 2.2
  5. Wilson Luu 2012-03-15

    Closing bug. Verified fix; Studio will not allow you to create projects that have Java keywords in the app id: SDK build: 2.0.0.v20120315091738 Titanium Studio, build: 2.0.0.201203142055 OS: Mac OS X Lion (10.7.2)

JSON Source