Android Studio need to rebuild project before each run

前端 未结 5 1800
灰色年华
灰色年华 2020-12-09 09:37

Recently the android studio shows Error Java cannot find Symbol or each run. i have to go to built and rebuilt the project before each run. Is there any way to fix it? i do

5条回答
  •  半阙折子戏
    2020-12-09 09:50

    in android studio version 2+, use this in all gradle config files

    android{
    ..
    
    compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
            incremental = false;
    }
    ...
    
    }
    

    and if you have experimental for ndk use like this

    model {
        android.compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
            incremental false
        }
    }
    

提交回复
热议问题