項目級別Gradle文件:頂級構建文件,您可以在其中添加對所有子項目/模塊通用的配置選項。在Android Studio中創建新項目時無法解析符號appCompatActivity?
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.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
}
模塊級gradle這個:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "in.co.persistent.gamedisappear"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
}
` 我知道這個問題被問了許多times.But我已經試過各種事情像無效/重啓cache.Also試圖重新啓動Android和建設新項目.Plus添加了所需的依賴項(compile'com.android.support:appcompat-v7:25.0.1')沒有任何作用!
請發佈您的錯誤代碼和gradle屬性爲您的應用程序:) –
我附上了我得到的錯誤圖像! – Delfin
你會發布你的build.gradle文件嗎? – TheAnonymous010