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.
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 successfullyCreate 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.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.
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.
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.
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]
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
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.
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.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
I think the underlying issue here is the same - Java not liking filenames with characters outside ASCII/the default charset/encoding.
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?
[~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.
Sorry for that. I am watching iOS Ticket! Thank you!