Netbeans does not see classes from a reference library

I am using netbeans 7.2 with the NBAndroid extension. In my Android project, I refer to a library (ActionBarSherlock), which is not in the bank (for some reason it cannot be). The problem is that netbeans does not see classes from this library and gives me errors (the package does not exist, etc.) However, it builds and works OK, the library is added correctly. Netbeans just doesn't see it.

Here is a screenshot .

Here is a similar question, no solution com.actionbarsherlock.app exists

Is there any way to fix this? Thanks for the help!


EDIT: So, I found a way to solve this problem, this is more a workaround than a solution. I created a jar file from library classes called classes.jar. I put it in the libs folder, so netbeans sees this. Than I created custom_rules.xml (it was imported through build.xml). In it, I move class.jar from the libs folder, so I can create it, and in the end I will return it.

<?xml version="1.0" encoding="UTF-8"?> <project name="imported"> <copy file="libs/classes.jar" todir="./" /> <delete file="libs/classes.jar" /> <target name="-post-compile"> <copy file="./classes.jar" todir="libs/" /> <delete file="./classes.jar" /> </target> </project> 
+1
source share
2 answers

The errors you see are related to the fact that NetBeans does not recognize packages, classes, methods, etc. When you create or run the program, NetBeans resorts to the Android Ant script project, which seems to be correctly configured to find classes. As for compilation and work, you will not have problems. However, if you want to use the autofill and error detection features of NetBeans, you need to configure it to detect your libraries. To do this, simply right-click on the name of your project in the "Project" panel and select "Properties" in the context menu. Then click "Libraries" in the "Categories on the left" section. Then click "Add JAR / Folder" and go to the folder with your third-party library. You can select one of the path options and click "OK." NetBeans should now be able to find identifiers and help you write your code.

-one
source

Instead of doing some tricks in your build script, I would recommend using ActionBarSherlock as a library project. You should be able to do this in the project settings (select the project, right-click, select properties).

Also see “Starting up your project” 2. at http://actionbarsherlock.com/usage.html

-Radim

-one
source

All Articles