Question

If I am doing a clean build I get a compile error when I am using an annotated activity that's not in the same package as the activity I am currently in.

Let me give an example: I have this activity com.example.packageA.A:

@EActivity
public class A extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        B_.intent(this).start();
    }
}

and this activity com.example.packageB.B:

@EActivity
public class B extends SherlockFragmentActivity {

}

When I am doing a clean build I'll get the following compile error: B_ cannot be resolved As soon as I change anything in A and save it the error disappears.

The error does not occur if both activities are in the same package. All classes are generated in .apt_generated folder.

Unfortunately I wasn't able to reproduce the problem in a new project. So it seems to have to do with some project specific settings. Let me know if you need further details.

Any hints and tips are highly appreciated because it's very annoying to go through all classes, add a space and save it to get rid of all errors I have after eclipse startup.

Était-ce utile?

La solution

It's a very well known issue of AA with Eclipse. As said in the project's FAQ page, you can fix it by either :

  • Importing the whole package: import com.example.packageB.*;
  • Using a fully qualified name : com.example.packageB.B_.intent(this).start();
  • Having A and B_ in the same package.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top