Monday, February 26, 2018

Common Android Studio Errors and Their Corresponding Error Messages

If your mistake is:

  • in your activity_main.xml, your  <RelativeLayout ...> accidentally has a closing tag of </> instead of </RelativeLayout>

then you will see:


In the example above, the Gradle Console tells you that your error was caused by line 138 of your activity_main.xml:

  • AGPBI: {"kind":"error","text":"error: not well-formed (invalid token).","sources":[{"file":"C:\\UsC:\Users\rob_t\AndroidStudioProjects\CourtCounter\app\src\main\res\layout\activity_main.xml:138: error: not well-formed (invalid token).ers\\rob_t\\AndroidStudioProjects\\CourtCounter\\app\\src\\main\\res\\layout\\activity_main.xml","position":{"startLine":137}}],"original":"","tool":"AAPT"}
That one mistake causes 7 errors to show up in your "Messages Gradle Build" window.


**

If your mistake is:

  • in your MainActivity.java, you forgot to put a closing semi-colon on line9

then you will see:


In the example above, the Gradle Console tells you that your error was caused by line 9 of your MainActivity.java:

  • file or directory 'C:\Users\rob_t\AndroidStudioProjects\CourtCounter\app\src\debug\java', not found
  • Compiling with JDK Java compiler API.

  • C:\Users\rob_t\AndroidStudioProjects\CourtCounter\app\src\main\java\com\example\android\courtcounter\MainActivity.java:9: error: ';' expected
  •     int scoreTeamA = 0
  •                       ^
  • 1 error

  • Incremental compilation of 1 classes completed in 0.597 secs.
  • :app:compileDebugJavaWithJavac FAILED



That one mistake causes 2 errors to show up in your "Messages Gradle Build" window.

No comments:

Post a Comment