Reputation: 41
I have tried invalidating the caches and restarting but it still shows up and will not compile and run as it used to before. I tried renaming the class file if i remember correctly and must have changed the name on something that made this how up. It also gives me the same error where findViewById, .oncreate, and setContentView. I migh have also renamed or tried to rename one of the packages because it was examplecom and it wouldnt allow me to upload it.
package com.threedeestone.mike.threedeestone;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.text.DecimalFormat;
public class MainActivity extends ActionBarActivity {
Upvotes: 4
Views: 11125
Reputation: 20656
Check this blog where explains the changes on the Library
.
ActionBarActivity
is deprecated, you should use AppCompatActivity
instead and make a clear project and try it out.
public class MainActivity extends AppCompatActivity {
If the issue still it could be that in your gradle.app
you don't have added this line of code
compile 'com.android.support:appcompat-v7:22.1.1'
Upvotes: 4
Reputation: 365028
To use the ActionBarActivity
or the AppCompatActivity
you have to add the appcompat library to your dependencies.
Add in your build.gradle
file the last version:
dependencies {
...
compile "com.android.support:appcompat-v7:23.0.0"
}
The version 23.0.0 requires to compile the project with API 23.
Otherwise you can use the 22.2.1.
Also pay attention.
The ActionBarActivity
is deprecated. Check the official javadoc.
You should use the AppCompatActivity
.
Upvotes: 4