Search code examples
androidapicastingfindviewbyid

How do i get the most updated api by android?


I would like to use the "new" findViewById that returns T extends View and not just View , what do i need to update to receive that ?

this is the updated Doc :

https://developer.android.com/reference/android/view/View.html

the new method is already there .


Solution

  • You have to install Android Studio 3.0 Preview/Canary and update all required SDK/Tools.

    You have to Target the new API-Level, e.g.:

    android {
       compileSdkVersion 'android-O'
       buildToolsVersion '26.0.0-rc2'
    
        defaultConfig {
            targetSdkVersion 'O'
            ....
        }
    }
    

    Note that the Preview is only available from the Google Maven Repository, e.g.:

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }