Reputation: 1
Yesterday i updated Android to Android 3.1.3, everything was kinda good until, today when i created a new Empty Activity and on "AppCompatActivity" showed me the error "cannot find the symbol", so then I searched and I read it had something to do with the "build.gradle", so I've been updating the libraries and got different errors, the latest one is that object "R" cannot resolve symbol. So here what I've got.
I've had many attempts to solve it (as you can see the comments in the code) but so far i haven't solve it. Please Help me!
Also in one section Android suggested me to change in the gradle.properties # org.gradle.parallel=true from false, and it didn't work either.
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'
}
}
}
dependecies
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: Logs
Upvotes: 0
Views: 923
Reputation: 101
Close the current project and again reopen it and rebuild solution. Most of the time by rebuilding the solution, "R cannot resolve" problem can be solved.
Upvotes: 0
Reputation: 1543
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
classpath 'com.android.tools.build:gradle:3.1.3'
compileSdkVersion 27
minSdkVersion 16
targetSdkVersion 27
implementation 'com.android.support:appcompat-v7:23.4.0'
implementation 'com.android.support:design:23.4.0'
implementation 'com.android.support:support-v4:23.4.0'
implementation 'com.android.support:recyclerview-v7:23.4.0'
File - Invalidate Caches/Restart - Invalidate and Restart
Upvotes: 0