[Android Studio] JusTeN_:
READ ONLY EDIT DOWN!!

Okay, so I can't develop nothing as my Android Studio decided to. My all project is full of errors, unknown errors caused by Android Studio.

note: my files are correct, it is an other problem because even if I will import something from google codes it will have errors.

When I import a project everything's fine, but then after indexing and such things, all sudden everything is red and shouldn't be.

My errors for example are :

button1.setOnLongClickListener(new View.OnLongClickListener() {
....
....
}

Well shouldn't be error but :

cannot resolve symbol setOnLongClickListener

Another example:

button1=(Button) findViewById(R.id.button1);

I used this exact code for other button, seems right, I always using this line, it was fine until my Android Studio decided to give me some hard time, this line is full by errors and they are:

Unknown class: 'button1' , invalid method declaration; return type required, missing method body, or declare abstract

and there are like 20 errors that shouldn't be, things I tried:

1.deleting iml files , .idea folder - worked for a while but now it happened again and it doesn't fix it.

2.reinstalling android studio and then importing project.

3.upgrading android studio version to 1.3

4.restarting my pc.

5.importing project to an other pc, happened after a while.

6.Invalidate caches/ restart.

7.Changing module in project structure - I changed it back to how it was (it didn't help) and I think it caused the manifest error down..

My Module:app build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'

defaultConfig {
applicationId "firstappdevelopments.david.reactiontime"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}

Also I noticed now, my Manifest file as an error in

android:name=".MainActivity"

says it has no default structure. something like this. here is the full normal code:

<?xml version="1.0" encoding="utf-8"?>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

</manifest>

Please, if someone knows what is the problem or what can I else do, just say, and I am sorry about my English, thank you all.

EDIT!!!:

I deleted this lines:

connect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bluetooth = BluetoothAdapter.getDefaultAdapter();
if (bluetooth != null) {
if (bluetooth.isEnabled()) {
bluetooth.startDiscovery();
Set<BluetoothDevice> bondedSet = bluetooth.getBondedDevices();
if(bondedSet.size() > 0){
for(BluetoothDevice device : bondedSet){
newDevicesListView.setVisibility(View.VISIBLE);
mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
}
}else{
mArrayAdapter.add("No Devices");
}

}
} else {
textview.setText("bluetooth is disabled, enabling.");
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, RESULT_OK);
}
} else{
textview.setText("Bluetooth is not supported.");
}
}
});

AND SUDDENLY ALL THE ERRORS DISSAPPEARED , ANY IDEAS? - The errors was in other lines..