Android studio 1.2 beta'无法解决符号'错误

时间:2015-04-10 16:14:43

标签: android

就像在标题中一样,我有很多这样的错误,但最奇怪的是我可以运行应用程序并且运行没有问题。

我发布了我的应用程序的gradle文件和代码片段,希望它们能帮助我找到解决这个令人讨厌的问题的解决方案。

这是第一个build.gradle:

// 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:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

这是第二个build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.parse'

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.parse.com/repo' }
    }
    dependencies {
        classpath 'com.parse.tools:gradle:1.+'
    }
}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.unisa.unistore"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.parse.bolts:bolts-android:1.1.4'
    compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile fileTree(dir: 'libs', include: 'ParseFacebookUtils-*.jar')
    compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
    compile 'com.android.support:appcompat-v7:22.0.0'
}

这是代码:

import android.content.Context; //Cannot resolve symbol 'Context'
import android.content.Intent; //Cannot resolve symbol 'Intent'
import android.os.Bundle; //Cannot resolve symbol 'Bundle'
import android.support.v4.app.FragmentActivity; //Cannot resolve symbol 'FragmentActivity'

import com.parse.ParseAnalytics; //Cannot resolve symbol 'ParseAnalytics'
import com.unisa.unistore.R;

public class MainActivity extends FragmentActivity { //Cannot resolve symbol 'FragmentActivity'
    private MainFragment mainFragment;

1 个答案:

答案 0 :(得分:0)

你做了导入:

import android.support.v4.app.FragmentActivity;

但在Gradle我看不到dependencies

中的行
compile 'com.android.support:support-v4:22.0.0'

只需添加此行,然后按sync now右上角的Studio即可。 希望它有所帮助。