Can not resolve method 'findViewById(int)'

前端 未结 9 849
孤城傲影
孤城傲影 2021-02-05 03:08

I\'m having a trouble with findViewByid but I can\'t find where the problem is.

Here\'s my FirstFragment class code:

import and         


        
9条回答
  •  长情又很酷
    2021-02-05 03:27

    I had this problem when I downloaded sample project from github. This project had

    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    targetSdkVersion 23
    

    in Activity context and findViewById() were in red color inside onCreate() method. So I updated the above versions to

    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    targetSdkVersion 25
    

    and error got resolved.

提交回复
热议问题