MainActivity.java contains:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void submitOrder(View view) {
display(1);
}
private void display(int number) {
TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);
quantityTextView.setText("" + number);
}
}
What is the reason for the compile error?
gradle.build:
apply plugin: 'com.android.application'
android { compileSdkVersion 24 buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.android.justjava"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.1.1' }
I have already tried: clean/rebuild project
.
its issues around your compileSdkVersion and buildToolVersion change it in your gradle file and you should be fine.
compileSdkVersion 24
buildToolsVersion '24.0.0'
you can as well update your targetSdkVersion
to 24