0

I am using windows 8 as operating system. I have a test method in Robolectric which has € in method name. When I run the test using Gradle wrapper in Android studio with gradlew test command, it is showing me following error:

error: illegal character: \172
    public void change_Ôé¼10() {
                                                           ^
2 errors                                     
:client:compileTestDebugJava FAILED          

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':client:compileTestDebugJava'.
> Compilation failed; see the compiler error output for details.

Try:        
Run with --stacktrace option to get the stack trace. Run with --info or --debug

BUILD FAILED  

I have researched about it and found out it could be related to encoding to UTF-8 It seems I need to use it without BOM:

Illegal Character when trying to compile java code

Android Project Compiled with Ant doesn't compile, Illegal Character Error

But I do not know how to fix it in a proper way exactly. Do you have any suggestion to fix in Android studio terminal?

Addenda: A friend of mine who uses Linux has no problem to run the test.

Community
  • 1
  • 1
Ali
  • 9,800
  • 19
  • 72
  • 152

1 Answers1

3

The proper way to fix this would be to remove the character from the method name.

I dont know of any actual limitations - you mentioned it works on a Linux machine - but it is terrible practice. Just spell out the word

Euro

r2DoesInc
  • 3,759
  • 3
  • 29
  • 60