Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17270] CLI: App name with accented characters fails to build

GitHub Issuen/a
TypeBug
PriorityHigh
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid, CLI
Labelscb-tooling, pm2, qe-3.3.0
ReporterLokesh Choudhary
AssigneeChris Barber
Created2014-07-03T21:52:10.000+0000
Updated2016-08-19T17:20:37.000+0000

Description

Description:

1. Create a classic/alloy app with accented characters in the app name. e.g ånålytiçs. 2. Build for android device/emulator.

Actual Result:

1. The build fails with the errors below:
ERROR] Failed to compile Java source files:
[ERROR]   
[ERROR] javac: file not found: /Users/lokeshchoudhary/Desktop/workspaces/test_workspace/Myånålytiçs/build/android/gen/android/support/v7/appcompat/R.java
[ERROR] Usage: javac <options> <source files>
[ERROR] use -help for a list of possible options

Expected Result:

1. The app with accented character in the app name should build & run successfully.

Solution:

The Titanium "create" and Android "build" commands must not allow non-ascii characters anywhere in the project path or any resource filenames.

Attachments

FileDateSize
diff.txt2014-07-08T00:42:38.000+000057423

Comments

  1. Lokesh Choudhary 2014-07-08

    Tried out few scenarios:

    Create an app with accented characters in studio:

    The build fails giving the error mentioned above in the description.

    Create an app with non-accented characters in studio & after creation change the app name to accented character in the tiapp.xml:

    The app builds successfully

    Create an app with accented characters in CLI:

    The build fails giving the error mentioned above in the description.

    Create an app with non-accented characters in CLI & after creation change the app name to accented character in the tiapp.xml:

    The app builds successfully A diff between the project created initially with accented characters & an app created with normal characters & then changed to accented characters in tiapp.xml after creation is attached for reference.
  2. Samuel Dowse 2014-07-08

    On iOS we see similar results: In all four scenarios that [~lchoudhary] has specified in his comment the app does build and install to device. However, applications that are created with accented characters, as apposed to those edited after creation to contain accented characters, will freeze on the splash screen.
  3. Chris Barber 2014-07-10

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5897 3_3_X pull request: https://github.com/appcelerator/titanium_mobile/pull/5898 To test, simply build a project that contains a special character in any directory containing the project.
  4. Ingo Muschenetz 2014-07-10

    Please note, this sets the default file encoding to UTF-8 when compiling. This _should_ be safe since we already warn about non UTF-8 encoding in files during the build process. However, I still would test this thoroughly on Windows and Mac. [Update] this evidently still has issues on Windows. My suggestion is that we don't use UTF-8 characters in the file path.
  5. Ingo Muschenetz 2014-07-10

    Reviewing this, I'm not positive this is the complete fix. Note that passing in the character encoding has been used as a fix for other projects: https://bugzilla.xamarin.com/show_bug.cgi?id=15559 However, it seems to me that we should also be stripping the unicode characters from the path. The folder name does not need to be: /Users/ingo/Documents/Projects/ånalytics (for instance) However, if the CLI did just that, would that cause problems for Studio? Or is Studio passing in the folder name to the CLI? [~cwilliams]
  6. Christopher Williams 2014-07-10

    If the user enters a project name with some UTF-8 character, then we will use that as the project name (as declared in Eclipse's .project file that will be placed in the root), but we also _default_ to using the project name as the folder name which is standard Eclipse behavior. When we create the project, we effectively call "ti create --name --workspace-dir " from the parent (workspace) directory. If the CLI takes that name and changes it to normalize it, then Studio will think the project is in "/path/to/project/parent/ånalytics" while CLI created "/path/to/project/parent/analytics". If we want Studio to not get confused then either the CLI and Studio have to agree on normalizing the names the same way (so we can update the expected project path), or Studio likely would need to implement some validation/enforcement of non-UTF-8 names (don't allow the user to use those characters), or we'd need some flag to tell CLI to just generate the files in the workspace-dir we pass directly rather than creating a subfolder from the project name (so we can normalize the name and know what it will be and CLI never creates the top-level folder based on project name).
  7. Samuel Dowse 2014-07-10

    Tested on: Mac OSX 10.9.4 Windows 8.1 Appcelerator Studio, build: 3.3.0.201407081443 Titanium SDK, build: 3.3.0.v20140709184436 Titanium CLI, build: 3.3.0-rc4 Alloy: 1.4.0-rc5 Apps containing special characters in the name build and install as expected on Android from a Mac. However, they fail on Windows 8.1. +Extra information+ While apps with special characters in the name build and install from a Mac, if the app contains a file with a special character (e.g. "fileØne.js") then the app will throw an error if the file is read.
       E/TiAssetHelper( 8264): Error while reading asset "Resources/fileØne.js":
       E/TiAssetHelper( 8264): java.io.FileNotFoundException: Resources/fileØne.js
       E/TiAssetHelper( 8264): 	at android.content.res.AssetManager.openAsset(Native Method)
       E/TiAssetHelper( 8264): 	at android.content.res.AssetManager.open(AssetManager.java:315)
       E/TiAssetHelper( 8264): 	at android.content.res.AssetManager.open(AssetManager.java:289)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:77)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:159)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:289)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:185)
       E/TiAssetHelper( 8264): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/TiAssetHelper( 8264): 	at android.os.Looper.loop(Looper.java:137)
       E/TiAssetHelper( 8264): 	at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
       
  8. Chris Barber 2014-07-10

    According to https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/AaptAssets.cpp#L27-L57, aapt does not support any non-ascii characters in filenames. The correct solution is to disallow projects to be created with names or in directories that contain non-ascii characters. Also, the Android build command will need to gracefully fail if the project is in a path that contains a non-ascii character or if any of the resources contain a non-ascii character in the filename.
  9. Chris Barber 2014-07-10

    Here's the revert for the PRs above: Master: https://github.com/appcelerator/titanium_mobile/pull/5902 3_3_X: https://github.com/appcelerator/titanium_mobile/pull/5903
  10. Christopher Williams 2014-07-21

    I think the underlying issue here is the same - Java not liking filenames with characters outside ASCII/the default charset/encoding.
  11. Thiago Delmotte 2015-09-23

    I am building an app with accent in the app name, on the tiapp.xml and I am getting the error below: [ERROR] xcodebuild: error: The project named "Pinión" does not contain a scheme named "Pinión". The "-list" option can be used to find the names of the schemes in the project. Could you help me?
  12. Chris Barber 2015-09-23

    [~delmotte] The issue you are experiencing is related to iOS, however this ticket is for an Android issue. I'm able to reproduce your issue and I've created a new issue that talks specifically about your issue: TIMOB-19571. Please watch that ticket to track progress on fixing it.
  13. Thiago Delmotte 2015-09-23

    Sorry for that. I am watching iOS Ticket! Thank you!

JSON Source