buildgradle配置
flavorDimensions "minApi"
productFlavors {
minApi23 {
dimension "minApi"
applicationId "com.jeanboy.app.flavorstest3"
}
minApi18 {
dimension "minApi"
applicationId "com.jeanboy.app.flavorstest4"
}
huawei {
dimension "minApi"
applicationId "com.jeanboy.app.flavorstest5"
}
}
目录
代码
package com.example.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
android.widget.Toast.makeText(this, ABC.ABC, Toast.LENGTH_SHORT).show();
// if(BuildConfig.FLAVOR.equals("ottest")){
// TextView textView = findViewById(R.id.aa);
// textView.setText("对外应用");
// }
}
}
切换
|