0

I am currently working on Android Studio. My doubt is, how to run Android Studio - "L preview" apps on lowest version devices like Android 2.2 , Android 2.3.3 (API 10) so on.

My 'L preview' app runs well in an emulator when I use current minSdkVersion as 'L' but it is not running in a real device. (I dont have 'L preview' device). So, I tried to change minSdkVersion as a lowest one

build.gradle - "min sdk version as 'L Preview'"

apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'

defaultConfig {
    applicationId "com.example.meenar.meenatesting"
    minSdkVersion 'L'
    targetSdkVersion 'L'
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
}

To run this L preview app on lowest version, just I changed in build.gradle like,

    minSdkVersion 8
    targetSdkVersion 'L'

In layout fab -> ie. res/layout/layoutfab, I have created a Image button with ripple background feature

layoutfab

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ImageButton
    android:id="@+id/fab"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:layout_width="@dimen/fab_size"
    android:layout_height="@dimen/fab_size"
    android:layout_gravity="bottom|right"
    android:layout_marginRight="16dp"
    android:layout_marginBottom="16dp"
    android:background="@drawable/ripple"
    android:stateListAnimator="@anim/anim"
    android:src="@drawable/ic_action_content_new"
    android:elevation="4dp"
    />
 </RelativeLayout>

ripple.xml

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item>
    <shape android:shape="oval">
        <solid android:color="#819FF7" />
    </shape>
</item>

If I change minsdkVersion as 8 then it is showing error in ripple.xml file.

Error is,

Error 1: requires API level 21 but current min version is 8

Error 2: ?android:colorControlHighlight requires API level 21 (current min is 8)

My doubt: Is there any other support and compatibility libraries to run 'L preview' apps on lowest devices? I need a ripple effect when I click button so is there any other possibility to run 'L preview' apps with a ripple effect?

How to run 'L preview' apps on lowest devices?

Community
  • 1
  • 1
Achiever
  • 1,626
  • 10
  • 30
  • 54
  • The ripple effect is done with an API available only in Android L. For this reason the apps cannot be backported. – rciovati Jul 28 '14 at 14:14
  • @rciovati - Even there is no support library also? So the only way is should I test this app on L preview device? – Achiever Jul 28 '14 at 14:35
  • @rciovati - okay, thankyou! only possibility is to check with L preview devices alone right? – Achiever Jul 29 '14 at 09:10

1 Answers1

2

How to run 'L preview' apps on lowest devices?

you cant. reason is stated in your error message :

Error 1: requires API level 21 but current min version is 8

AC28
  • 282
  • 2
  • 11