Error while building project. #4984
Replies: 5 comments 13 replies
-
|
@jkugsiya please follow this: In Android Studio, the default file encoding can be determined by the operating system's default encoding. Android Studio follows the default encoding set by the underlying platform to handle file encoding for various operations, such as reading and writing files. On different operating systems, the default file encoding may vary: Windows: The default file encoding on Windows is typically Cp1252 (also known as Windows-1252). macOS: The default file encoding on macOS is usually UTF-8. Linux: On Linux distributions, the default file encoding can vary depending on the distribution and system configuration. However, UTF-8 is widely used and often set as the default encoding. You can change your file encoding to UTF-8 by visiting
Hope this will fix your issue, if it then please mark this as answer to help others in community. |
Beta Was this translation helpful? Give feedback.
-
|
I think this is a problem with your Git client on Windows. It seems that it's automatically converting UTF-8 files coming from GitHub into CP1252 which is tripping up the Java compiler in this case. For more details: some of the comments in the OppiaLanguage proto file includes Unicode characters: These files should be encoded in UTF-8 by default. When the proto compiler generates Java code, it directly copies proto field arguments from the proto file to the generated Java source file. I suspect this is a byte-level copy with no re-encoding going on, so if your Git client is automatically re-encoding pulled UTF-8 files with Unicode characters to CP1252 then we end up with a Java file that's probably in both CP1252 (for the copied comments) and either UTF-8 or ANSI (depending on the proto compiler), and the Java compiler doesn't seem to handle that well. You may need to configure your local environment to use UTF-8 by default. However, per https://stackoverflow.com/a/48908993/3689782 it seems that the easiest way to do this would actually be by using .gitattributes (which we can check in directly to Oppia Android). A short-term solution may be to forcibly convert all of your checked out repository files to UTF-8 by doing something like: https://stackoverflow.com/a/52695560/3689782. |
Beta Was this translation helpful? Give feedback.
-
|
Please see this discussion for #4760 (comment): Which Android Studio and Java version do you have? It's recommended to build with Java 11, which is embedded in AS. Please see setup instructions if you need help configuring this. |
Beta Was this translation helpful? Give feedback.
-
|
@adhiamboperes I am using AS Flamingo, Android SDK 31, 28 and Gradle JDK 11. Am i doing something wrong? PS: the previous encoding issue is fixed but there is a new issue -> :model:compileJava failed , :app:processDebugMainfest fail. |
Beta Was this translation helpful? Give feedback.
-
|
@jkugsiya how did you fix the " Execution failed for task ':utility:kaptDebugKotlin'. " error ? |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Operating System
Windows 11
Android Studio Version
Android Studio Flamingo | 2022.2.1 Patch 1
RAM size
16 GB
Free disk space
300 GB
Which step are you stuck on?
I am getting this error:

I've tried the steps found in a GitHub discussion to change encoding to UTF-8 but not solved yet.

Error Log
Approaches already used to resolve the issue
Tried the solution that was found in a GitHub discussion.
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions