Yes. I know this is trivial. But this is getting silly.
Image proving the error:
The code:
package apack.age;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
public class DisplayContactActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.display_contact_layout);
}
public void openSubreddit(View view)
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.reddit.com")));
}
public void openTwitter(View view)
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://twitter.com")));
}
public void openGmail(View view)
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("www.gmail.com")));
}
}
Seriously. There's 5 open and 5 close braces. This is my first attempt at an android app but I have 3 years of Java experience so this is pretty frustrating.
Run errors out. Refresh does nothing. Project clean does nothing. Auto code format in eclipse (CTRL + SHIFT + F) does nothing.
EDIT 1: Copying the code to a new class gets it to compile. I'm running the new version of Eclipse: Juno. I've done source -> cleanup and it just says "nothing to change" every time!
Edit: Please upgrade to ADT 20.0.1, where this has been fixed.
Switch to the Lint view, use the Clean button to remove all lint errors. There is a bug with lint in ADT 20, that it sometimes takes over the Java compiler bugs.
You can verify if this is really the problem by looking at the "Origin" column of this bug in your Problems view. Normally that should be "Java problem" for this error, but it will be "Lint" instead.
Try to save the file with Ctrl+S
, it happens to me sometimes. Also, it seems that you forget to insert the package name at the beginning of the code:
package com.example.my_application;
There's gotta be a snapin in your eclipse with the issue. Have you tried a virgin eclipse install?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With