1

Please help don't know why I'm getting those errors, but here's the Error codes: Error:(5, 1) error: illegal character: '\u2028',

Error:(5, 9) error: class

interface, or enum expected. :app:compileDebugJavaWithJavac FAILED,

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. Compilation failed; see the compiler error output for details. Here is

 package com.example.ruebens.thequotebooks;
    
   

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
    
    
public class MainActivity extends AppCompatActivity
    {
        TextView tvText;
        Button btnClick;
        @Override
        protected void onCreate( Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            tvText=(TextView)findViewById(R.id.tvText);
            btnClick=(Button)findViewById(R.id.btnClick);
    
    
            btnClick.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
    
                    tvText.setText("The more you practice\nThe more you learn\nHow to create Android Apps" );
                }
            });
        }
    }
Community
  • 1
  • 1
  • 2
    Did you copy and paste some part of this code from somewhere else, maybe a webpage online, or some other file? "\u2028" is unicode for a line break, but it's not the usual CR , or CR LF combination. Depending on where this file came from or how you created it, you may need to load it in a text editor that can display special characters and see what non-printable characters are in this file, and the remove/replace the ones Android Studio doesn't like. – Kevin Hooke Sep 06 '16 at 01:18
  • @KevinHooke i had a problem with it at first so i saved on Atom( coding application) and copied and paste in to android studio. I'll paste in text editor – reuben mills Sep 06 '16 at 01:23
  • @KevinHooke I did it, the coding is still the same. – reuben mills Sep 06 '16 at 01:25
  • Try opening the file in something like notepad++ and press the button on the toolbar to show non-printable characters, and see what's in the file... and take a look at the question this is marked a duplicate of, that should help you... – Kevin Hooke Sep 06 '16 at 05:09
  • @KevinHooke Thank you, I had to rewrite my whole program, because Android Studio doesn't won't you to Copy&Paste. – reuben mills Sep 08 '16 at 13:10
  • Where were you copying the code from (just out of interest and for everyone else's future benefit)? That's more likely the cause of the issue. Where ever you copied the code from had additional non-printable characters in the source. – Kevin Hooke Sep 08 '16 at 16:34

0 Answers0