Jorge E. Hernández
Jorge E. Hernández

Reputation: 2938

How to Compile project against API 19/Reference the AppCompat library in order to use android.hardware.Camera?

Recently, with the Android API 21 release, I have updated the Android SDK and the Eclipse ADT plug-in.

I imported the AppCompat library project from $ANDROID_SDK/extras/android/support/v7/appcompat. It was imported and compiled successfully with no errors:

enter image description here

Now, when I reference the AppCompat library project from my android application project it throws the following errors errors:

[2014-10-21 13:36:09 - AndroidApp] /Users/lalongooo/dev/java/android/sdk/extras/android/support/v7/appcompat/res/values-v21/styles_base.xml:101: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
[2014-10-21 13:36:09 - AndroidApp] /Users/lalongooo/dev/java/android/sdk/extras/android/support/v7/appcompat/res/values-v21/styles_base_text.xml:62: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
[2014-10-21 13:36:09 - AndroidApp] /Users/lalongooo/dev/java/android/sdk/extras/android/support/v7/appcompat/res/values-v21/themes_base.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
[2014-10-21 13:36:09 - AndroidApp] /Users/lalongooo/dev/java/android/sdk/extras/android/support/v7/appcompat/res/values-v21/styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
[2014-10-21 13:36:09 - AndroidApp] /Users/lalongooo/dev/java/android/sdk/extras/android/support/v7/appcompat/res/values-v21/styles_base_text.xml:62: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
...

I know this is solved by changing the Project Build Target via:

  1. Right-click on the project
  2. Properties
  3. Android "tab"
  4. Select "Android 5.0 - API Level 21"
  5. Click "Apply"

enter image description here

But I need to build my project against the API Level 19 in order to access the now deprecated android.hardware.Camera class.

Upvotes: 1

Views: 2365

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 199805

Deprecated does not mean removed. You can still use android.hardware.Camera classes (and you'll need to if you want to continue to support lower than API 21 devices), but it means you should test throughly on API 21 devices and add conditional code so that API 21+ devices use the new Camera2 API.

Upvotes: 3

Related Questions