So I forced Android Studio to stop in the middle of stopping a gradle build (I know, how idiotic of me) because it was taking forever and it kept not responding and when I opened it back up it was okay and I could create a new layout file but when I created a new java class it decided it didn't like importing android.support.v7.app.AppCompatActivity in any of my java classes (but if I don't open them to look at them, there is no red squiggly underline) and it says that it "cannot resolve symbol 'app'". I can't find any questions with this specific problem and I have tried the solutions to questions about the whole import. I've tried cleaning and rebuilding, invalidating the caches and restarting, making the project, building the APK, closing and reopening the project, closing and reopening Android Studio...
The app file seems okay other than the last compile which says to upgrade to 24.1.1 but then when I do it says that "this support library should not use a different version (24) than the compileSdkVersion(23)" but if I change the compileSdkVersion to 24 it says that it "failed to find target with hash string 'android-24' in [the sdk]".
App file:
//noinspection GradleCompatible
//noinspection GradleCompatible
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "abigailbannister.qmbtour"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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:23.4.0'
}
Build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
General structure of java classes:
package abigailbannister.qmbtour;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.RelativeLayout;
/**
* Created by Abigail on 15/08/2016.
*/
public class basic_activity extends AppCompatActivity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.basic_layout);
}
}
Basic structure of layout files:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="."
android:clickable="true"
android:background="#FFFFFF">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/header_image"
android:src="@drawable/qmb_logo"
android:layout_marginBottom="483dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="abigailbannister.qmbtour">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".LanguageSelectionActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".EnglishWelcomeActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FrenchWelcomeActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MenuActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Sorry for all the code but I have no idea what will fix this :/