greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

Execution failed for task ':app:greendao' - UnsupportedEncodingException: UTF- #1121

Open Dhy521 opened 2 months ago

Dhy521 commented 2 months ago

Execution failed for task ':app:greendao'.

java.io.UnsupportedEncodingException: UTF- 微信截图_20240929133439

May I ask how to solve this problem I have tried many solutions, but none of them are feasible

greenrobot-team commented 1 month ago

My guess is that the default encoding of the platform you are working on is not set correctly.

Maybe try to set the encoding for this project via Gradle options. Something like:

tasks.withType<JavaCompile> {
    // Note: Gradle defaults to the platform default encoding, make sure to always use UTF-8 for UTF-8 tests.
    options.encoding = "UTF-8"
}

Note: This project is not longer actively maintained. If you are looking for an easy to use and efficient database solution, please check out our other project ObjectBox.

Dhy521 commented 1 month ago

您的这个方案我已经尝试了 还是不可行 但是我的同事们就可以正常运行 您还有其他的方案吗

Translation: I've tried your solution and it still doesn't work, but my colleagues can run it normally. Do you have any other solutions?

greenrobot-team commented 1 month ago

I just realized the issue is with the greendao task. I guess you should check that the encoding for the JVM used to run Gradle has UTF-8 configured as its encoding.