Resource not found: Theme.Leanback

I am creating an Android application for Tv and I am setting the theme as the theme. Lananback is defined in the android-support-v17-leanback.jar support library. But when I create my application, I get an error saying that " Error: the resource was not found that matches the specified name (in the 'topic' with the value '@ style / Theme.Leanback') "
I added the android-support-v17-leanback library to build the path while I get the same error.

I even created the android-support-v17-leanback library, importing it into eclipse, and I see the resource identifier in the R.txt project file, and I added this built-in project to my application, but still the same error.

Anything I miss? Please suggest some thoughts to solve the above problem.

Thanks Storyteller

+5
source share
2 answers

Add appcompat-v7 and leanback in the 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 in core activity (Launcher)

 <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> 

Build.gradle example:

 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' } 
+5
source

I had the same issue with Android Studio. It magically started working after File> Invalid Cache / Reboot.

+3
source

Source: https://habr.com/ru/post/1214492/


All Articles