Eclipse references external Project Android library

Source: Internet
Author: User

1. Apply an external jar package

The most common way to put the jar package to be introduced in Project's Lib directory and Add JARs


2. Referencing Java Project

When I recently studied libgdx, I found that project can be referenced to each other, limited to Java Project,android Project can only reference Java project, cannot be directly referenced, if you need to invoke the code in Android project ,

Need to turn to Java project to refer to the code SRC specifically for a Java project, ADD JARs Android-2.0.jar

@ can refer to Android project see 3


Projects connecting an external Java project



Androidproject turn into Java project



The advantage of this is that we can use the source of external projects to carry out the joint adjustment , or more convenient.


3. Referencing Android Project

2011.9.7

Android 2.2 will be able to reference Android project after Android

Android.library Property

Create and use Android Library project

Lib project is set to is Library Default.properties will have one more android.library=true


Main project refers to the LIB project default.properties that just now has one more android.library.reference.1=. /libproject


Note the points:

1. Androidmanifest.xml only main project is valid, the permissions and activity statements in Lib Project's androidmanifest must be written in main project Androidmanifest In

2. You can apply the resources below Res in Lib project, but the resource name cannot be the same, otherwise you can only use the resources under main project

main project will generate 2 fully same the R.java


Resource intermodulation This piece still needs more practice to know the effect

3. When Lib project has an external LIB jar package, main project also needs to introduce a change jar package

4. This method needs to be used with caution, when the project is large, eclipse speed will be very slow ~ ~"The pit Daddy, the speed is too slow can only give up this way."

5. The R file for Lib project is not final and cannot be handled by a switch case


Eclipse references external Project Android library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.