Error while building project. #4984
-
Beta Was this translation helpful? Give feedback.
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.
This issue is related to our use of jetifier currently. I believe it will be resolved with the upcoming build platform changes, but to explain a bit:
In gradle.properties,
android.enableJetifier=true
automatically converts third-party libraries to use AndroidX.The maximum supported major version for jetifier class file format in Android is 58, which corresponds to Java 14.
The
model.jar
was compiled with Java 15/major version 59, hence the incompatibility.A fix would be to compile the JAR file with a lower version of Java.
@jkugsiya can you please check using https://developer.android.com/studio/intro/studio-config#jdk.
looks like you're using JDK 15--this isn't supported with our versi…