Alex Rivera | Logout

Library project build version higher than projects using it

Asked 2012-03-11T19:32:43.977
10

I am using Android Library Project. I have set my library project build target to say 11 to use api 11 and to have forward compatibility and I am putting check for min sdk version so that app will not crash when run on os < 11

My other projects have build target set to 8 so I want to know is it the correct way to set library project build version higher than the projects with lower build target going to use it?

right now I haven't observed any crash. Just wanted to know can the library with higher build version be used in projects with lower build sdk version than library.

Thanks in advance.:)

Edit
Report

1 Answer

2

Using a library with higher API level than the application is not recommended. If you referenced any API 11 only features in library and then use API 8 to compile with your app, then it should not compile at all. Do you actually have API 11 references in your library's code?

See Android docs:

In general, the library project should use an API level that is the same as — or lower than — that used by the application. If the library project uses an API level that is higher than that of the application, the application project will not compile.

answered 2012-03-11T20:21:11.163

Your Answer