1

I have just started writing my first android app. Initially I started with Eclipse plus ADT plugin and launching the app on my phone worked fine. I then switched to Android studio and whilst I prefer the IDE I cannot, for the life of me, get the app to launch on my phone any more.

I am using a Google Nexus 4 with android version 4.4.4 (KitKat) API version 19.

I set up my project to have a minimum SDK version of 15 (Ice Cream Sandwich) and Android Studio automatically set my target SDK to 'L' and uses the 'android-L' compiler.

The error I receive when trying to launch my app at these settings is:

pkg: /data/local/tmp/com.example.me142.socialprogrammingapp Failure[INSTALL_FAILED_OLDER_SDK]

I have tried changing the minSDK and targetSDK in my build.gradle file, this has made no difference.

I have also tried lowering the compiledSDKVersion but this leads to another error:

Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.

In my styles.xml file.

For reference, here is my build.gradle code:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "com.example.me142.socialprogrammingapp"
        minSdkVersion 15
        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'])
}

I would also like to mention that the only modifications I have made (other than playing around with the build.gradle) since creating the new project in Android Studio is add some buttons to the main activity, which, so far, do nothing when clicked.

If anyone can help then it would be much appreciated and if you need any more info then just ask.

Thanks

Quanqai
  • 647
  • 1
  • 5
  • 10
  • `targetSdkVersion 'L'` You're targeting the L developer preview, while your device has Android 4.4 kitkat. See http://stackoverflow.com/a/24666964/82788 – matiash Jul 12 '14 at 20:13
  • So do I need to download new SDK versions under the SDK Manager? At the moment I have Android L and 4.4W downloaded. Also is targetSDK the only thing I need to change in my build.gradle file? – Quanqai Jul 12 '14 at 20:20
  • You should download API level 19, then change both compileSdkVersion and targetSdkVersion. – matiash Jul 12 '14 at 20:21
  • I have downloaded the level 19 API and made the changes you suggest. This has now led back to the error I mentioned in my opening post in the styles.xml file regarding the theme. Do I need to change the theme for my app? – Quanqai Jul 12 '14 at 20:45
  • nevermind, changed the app to a basic android:Theme.Black and it is now working. Thank you very much for your help! – Quanqai Jul 12 '14 at 20:50
  • No problem. And for API level 19 you'd probably want to use Theme.Holo or one of its variants. – matiash Jul 12 '14 at 20:52

0 Answers0