0
有沒有辦法給編譯器提供一段源代碼不能編譯或編譯的命令?例如:Android Studio中的編譯器開關
// To set the adView with some listener
final AdView adView = (AdView) this.findViewById(R.id.adView);
adView.setAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
adView.setVisibility(View.GONE);
}
@Override
public void onAdLoaded() {
super.onAdLoaded();
adView.clearFocus();
adView.setVisibility(View.VISIBLE);
}
});
//request TEST ads to avoid being disabled for clicking your own ads
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)// This is for emulators
//test mode on DEVICE (this example code must be replaced with your device uniquq ID)
.build();
adView.loadAd(adRequest);
這段代碼我想要版本X和版本Y這個源代碼忽略,如果我構建的APK。我想在一個源代碼中有兩個或更多版本,我將控制構建APK中的哪些源代碼。
謝謝,產品口味是什麼,我想的東西。 –