Resource not found : Theme.Leanback
Asked Answered
K

3

8

I'm building android app for Tv and I'm setting theme as a Theme.Leanback is defined in android-support-v17-leanback.jar support library. But when I build my app getting error saying that "Error: No resource found that matches the given name (at 'theme' with value '@style/ Theme.Leanback')"
I have added the android-support-v17-leanback library to build path still I'm getting same error.

Even have built the android-support-v17-leanback library by importing to the eclipse and I'm seeing the resource id in R.txt file of project and I've added this built project to my app but still same error.

Anything I'm missing ?? Please suggest some thoughts to solve above problem.

Thanks, Narrator

Karilla answered 2/3, 2015 at 16:47 Comment(1)
Could you share your current configuration? e.g., a screenshot of your Eclipse project setup (especially the part where you include the library), some code..Nevertheless
I
12

Add appcompat-v7 and leanback in dependencies section in build.gradle

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:leanback-v17:23.1.1'

In style.xml

<style name="AppTheme" parent="@style/Theme.Leanback">

Refer: https://developer.android.com/tools/support-library/features.html#v17-leanback

in AndroidManifest.xml under main activity(Launcher)

<intent-filter>               

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LEANBACK_LAUNCHER" />

</intent-filter>

Sample build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.COMPANYNAME.something"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:leanback-v17:23.1.1'
    compile 'com.android.support:design:23.1.1'
}
Ingrowth answered 2/3, 2015 at 17:42 Comment(0)
R
3

I had the same issue using Android Studio. It magically started working after "File" > "Invalidate Caches / Restart".

Refectory answered 24/5, 2015 at 23:59 Comment(2)
it didn't work for me.. Am using Andriod Studio 2 Preview 7Corposant
same on Android Studio 2 Preview 9Hollister
F
0

FYI if you need the list of available version numbers, you can get them here:

Google Support Library Revisions

Futures answered 22/8, 2018 at 0:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.