Objective
Last night on a different Android to do the final online test, suddenly a normal upgrade on other platforms features reported "Java.lang.NoClassDefFoundError" error. Hurry adb logcat *:w view the error log and discover that the referenced third-party project class does not exist. Fortunately Ali side Daniel More, and ordinary walk relatively late, a little explanation of my use of the situation, I pointed out the third party project introduced the wrong way, here to record.
The introduction of the engineering step is an example of how to add "Android-pulltorefresh" to my test project in the "Android-pulltorefresh", an open source project that is currently very well known.
Create a test project, import a Pulltorefresh project create a test project there's nothing to say, it's you new Android project.
The steps to import Pulltorefresh engineering are as follows:
1. Git clone works to a local directory
git clone https://github.com/chrisbanes/Android-PullToRefresh.git
2. To import the project to eclipse, proceed as follows:
File--Import--android--Existing android Code into Workspace
Next, Browser, select the Pulltorefresh Project catalog, finish can (only import library here)
Statically Importing library libraries
1. Select the project that you want to rely on Pulltorefresh right-click Properties
2. Under the Library column, click Add to add the previously Pulltorefresh Library project.
3. Project---clean projects.
To verify that the third-party project is imported correctly, you can view the Project.Properties file for the project itself, as follows:
# This file was automatically generated by Android tools.# does not modify this file--YOUR changes would be erased!## this F Ile must is checked in Version Control systems.## to customize properties used by the Ant build system edit# "Ant.properti Es ", and override values to adapt the script to your# project structure.## to enable Proguard to shrink and obfuscate your Code, uncomment this (available Properties:sdk.dir, user.home): #proguard. config=${sdk.dir}/tools/proguard/ proguard-android.txt:proguard-project.txt# Project target.target=android-19android.library.reference.1=. /.. /.. /.. /tmp/android-pulltorefresh/library
The presence of android.library.refreence.* means that you have correctly imported a third-party project, enjoy!