Error(1,1)illegalcharacter '\ufeff' when compiling on android studio

后端 未结 15 1676
旧巷少年郎
旧巷少年郎 2020-12-14 05:50

I got an Eclipse project source code(I was told that on Android Studio, maybe they just confused), and I start to migrating the code to android studio refers to

相关标签:
15条回答
  • 2020-12-14 06:21

    Above are great solutions. However, if none of them works, try this one:

    Open the file in Notepad++; Copy everything; Create a new file with the same name; Paste everything; Save it.

    Now it is gone.

    0 讨论(0)
  • 2020-12-14 06:21

    OPEN LOOPView.java File First

    Convert Your UTF8 To ISO 8859-1 TO Solve your problem In andorid Studio

    If UTf-8 not show in android studio bottom bar then ctl+shift+n open LoopView Class then so Bottom Bar

    Note ISO-8859-1 Use this

    If your error not resolved then Invalidate cache and Restart again and

    gradlew clean npm start -- --reset-cache react-native run-android react-native run-ios

    Solve Your issue permenantly

    One Other Thing if issue still persist then com.wheel file copy into notepad++ and again copy and paste in your project

     android {  
       compileOptions.encoding = 'ISO-8859-1'
     }
    

    In React-native change in index.js / android/index.js

    import PropTypes from 'prop-types';

    0 讨论(0)
  • 2020-12-14 06:24

    I was facing this error in intelliJ-2016.1.2.

    Thank you @Darsh for your help, I did same thing, first changed to UTF-16 (i.e convert into UTF-16) and compiled the code. it didn't work, then again changed back to the UTF-8, this time it worked fine.

    Thank you.

    0 讨论(0)
  • 2020-12-14 06:30

    You can try to this method:

    1. Rename the class like class1.java
    2. Create a new class some renamed class like class.java
    3. Select all contain renamed file and copy into the new class.

    This method work for me.

    0 讨论(0)
  • 2020-12-14 06:31

    I tried several of the other answers here with no joy.

    In the end I simply deleted the offending line and rewrote it directly into Android Studio. The error disappeared.

    Was this caused by me copying and pasting the line of code from youtube (or whatever random blog I was looking at at the time)?

    0 讨论(0)
  • 2020-12-14 06:32

    Close android studio and reopen it. It works for me. Furthermore this could happen if you are copying a comment from youtube for example and pasting it into your project

    0 讨论(0)
提交回复
热议问题