0

I want to build Android TV Settings app that I clone from Google Git repository. I am using Android Studio 3.3.2, Gradle version adapts autoamtically to the SDK release.

I first tried to generate automatically a new gradle project from TvSettings/Settings directory. It did never build for different reasons Now I try to create a new gradle project as indicated here section "Migrate by creating a custom Gradle build file".

In the TvSettings/Settings file tree I cloned from Git repository I add 3 symbolic links (on res and com directories and AndroidManifest.xml file) in order to fit Gradle file tree expectations

Then I add a build.gradle file at project level (I add its content at the bottopm of this thread, may be it is really wrong as I not very used to generate with Gradle).

The build fails with a warning and two errors. Just see:

Android resource compilation failed
build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1077: warn: multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?.
build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1580: error: duplicate value for resource 'attr/orientation' with config ''.
build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1580: error: resource previously defined here.

I tried lots of things : - clean - invalidate cache and restart - limitate drastically the number of libraries - specify different API versions (23, 26 and 18), associated with the right library releases

How can I solve this ?

Thank you for help

Galgo
  • 55
  • 9
Christian
  • 21
  • 2

2 Answers2

0

uildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23

    defaultConfig {
        applicationId "com.android.tv.settings"
        minSdkVersion 23
        targetSdkVersion 23
        vectorDrawables.useSupportLibrary = true
    }

    sourceSets {
        main {
            manifest.srcFile 'app/AndroidManifest.xml'
            java.srcDirs = ['app/src']
            resources.srcDirs = ['app/src']
            aidl.srcDirs = ['app/src']
            renderscript.srcDirs = ['app/src']
            res.srcDirs = ['app/res']
            assets.srcDirs = ['app/assets']
        }

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:gridlayout-v7:23.0.0'
}
Christian
  • 21
  • 2
0

Well I solved this used by referencing the libraries that are listed in Settings module Android.mk file.

The right library list is :

implementation 'com.android.support:recyclerview-v7:28.0.0-beta01'
implementation 'com.android.support:preference-v7:28.0.0-beta01'
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support:preference-v14:28.0.0-beta01'
implementation 'com.android.support:preference-leanback-v17:28.0.0-beta01'
implementation 'com.android.support:leanback-v17:28.0.0-beta01'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:common-java8:1.1.1'
Christian
  • 21
  • 2