Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my project compatible with different sdk versions while using features for an specific version

Tags:

I'm developing a project that uses a Flash video within a webview. I solved all my problems regarding to code, but only worked below Honeycomb.

Reading this I found out how to solve the problems for Android 3.0 and later (including ICS), but now it's the big question... If I make my project compatible with ICS I've got to use the directive, but then I wouldn't run on Gingerbread.

To provide some more info... the problematic piece of code is this one:

android:hardwareAccelerated="true"

which is a property that was included in Android 3.0.

So, is there anything I can do to avoid building two different apks (somehitng like a pre-HoneyComb apk and post-HoneyComb apk)?

This is a piece of my Android manifest:

<application android:label="@string/app_name" 
             android:icon="@drawable/elabora"
             android:theme="@android:style/Theme.NoTitleBar">
    <activity android:name="es.fundacionvodafone.elabora.android.controlador.InicioElaboraTest"
              android:label="@string/app_name"
              android:noHistory="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="es.fundacionvodafone.elabora.android.controlador.InicioElabora"
              android:configChanges="orientation|keyboardHidden"
              android:label="@string/app_name"  
              android:hardwareAccelerated="true">
            <!--            
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            -->
    </activity>

Thanks in advance.

Update: I was already using what Mike explained, it's to say, defining minSdk and targetSdk properly, but I was confused by the following fact. With such a project configuration, when you run the project in eclipse, it prompts the following window: Capture of eclipse running a project with a targetSdk above the device api level The red cross means that the project targetSdk level is above the device API level. So I thought it was just not working in this device, but the thing is you can actually run it, and works as expected.