Saturday, November 8, 2014

Android: The import javax.annotation cannot be resolved


I was trying to compile some code from AOSP (Android Open Source Project), and I ran into this error:

The import javax.annotation cannot be resolved

Caused by this code:

import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;


The solution was actually really easy:
  1. Go here:
    http://mvnrepository.com/artifact/com.google.code.findbugs/jsr305

  2. In the Version column click on the latest version number

  3. Click Download ( JAR )

  4. Copy the downloaded JAR file to the libs folder in your Android project (create the libs folder if it doesn't already exist).

0 comments:

Post a Comment