让Android Studo 不编译某个Java文件
有时为了调试,让某些文件暂时不需编译,这样可以排除错误带来的无法运行情况,
可以在build.gradle中加入:excludes = ['com.coolweather.myble/AddrInterceptor.java'],如下
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets{
main {
java {
excludes = ['com.coolweather.myble/AddrInterceptor.java']
excludes = ['com.coolweather.myble/app.java']
excludes = ['com.coolweather.myble/BaseActivity.java']
excludes = ['com.coolweather.myble/BleCallBack.java']
excludes = ['com.coolweather.myble/BleManager.java']
excludes = ['com.coolweather.myble/BluetoothService.java']
excludes = ['com.coolweather.myble/DeviceAdapter.java']
excludes = ['com.coolweather.myble/IBle.java']
excludes = ['com.coolweather.myble/MainActivity.java']
excludes = ['com.coolweather.myble/MainActivity2.java']
excludes = ['com.coolweather.myble/NameInterceptor.java']
excludes = ['com.coolweather.myble/RefreshDatas.java']
excludes = ['com.coolweather.myble/ScanCallback.java']
excludes = ['com.coolweather.myble/ScanDeviceAdapter.java']
excludes = ['com.coolweather.myble/ScanInterceptor.java']
}
}