【发布时间】:2018-07-12 07:00:09
【问题描述】:
昨天我将 Android 更新到 Android 3.1.3,一切都还不错,直到今天我创建了一个新的 Empty Activity 并且在“AppCompatActivity”上显示错误“找不到符号”,所以我搜索并阅读它与“build.gradle”有关,所以我一直在更新库并得到不同的错误,最新的一个是对象“R”无法解析符号。所以这就是我所拥有的。
我已经多次尝试解决它(如您在代码中看到的 cmets),但到目前为止我还没有解决它。请帮我!
还有一个部分,Android 建议我将 gradle.properties # org.gradle.parallel=true 从 false 更改,但它也不起作用。
build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
//classpath 'com.android.tools.build:gradle:2.1.3'
//classpath 'com.android.tools.build:gradle:3.2.0-alpha17'
//classpath 'com.android.tools.build:gradle:3.1.3'
//classpath 'com.google.gms:google-services:3.2.0'
//classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
//name 'Google'
}
}
}
依赖
android {
compileSdkVersion 23
buildToolsVersion '24.0.2'
defaultConfig {
applicationId "com.example.dell.getspeed"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'net.gotev:uploadservice:2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
/*implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
/*implementation 'com.android.support.constraint:constraint-layout:1.1.2'
//implementation 'com.android.support:appcompat-v7:27.1.0'
//implementation 'com.android.support:design:26.4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.github.anastr:speedviewlib:1.2.0'
compile 'com.android.support:design:25.4.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//compile 'com.android.support.constraint:constraint-layout:1.1.2'*/
}
gralde-wrapper.propierties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
日志: Logs
【问题讨论】:
-
尝试清理您的项目并重建它。
-
转到文件> 无效并重新启动,然后单击无效并重新启动
-
我已经清理并重建了它,但它没有用@Ankita
-
我刚做了,但没用@Priyank
标签: android android-studio gradle cannot-find-symbol