Reputation: 761
Got prompted for an update and let it do its thing and got these errors everything worked fine before the update.
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :app:compileDebugSources]
/Users/.../topografie/activity/FlashCardActivity.java
Error:(60, 14) error: cannot find symbol method addOnPageChangeListener()
/Users/.../topografie/activity/MainActivity.java
Error:(87, 14) error: cannot find symbol method addOnPageChangeListener(OnPageChangeListener)
/Users/.../topografie/activity/MuscleDetailActivity.java
Error:(58, 14) error: cannot find symbol method addOnPageChangeListener()
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Information:BUILD FAILED in 2s
Information:4 errors
Information:0 warnings
Information:See complete output in console
Gradle console says:
symbol: method addOnPageChangeListener(OnPageChangeListener)
location: variable pager of type ViewPager
Note: /Users/.../MuscleDetailActivity.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
I've come across several similar questions, but none of the answers worked for me. I've cleaned and rebuild the project and I updated all the dependencies in Gradle. EDIT: Gradle syncs fine, but the project build gives error
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.anatomie.bny.topografie"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/android-support-v13.jar')
compile files('libs/picasso-2.5.2.jar')
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.github.AndroidDeveloperLB:AutoFitTextView:4'
testCompile 'junit:junit:4.12'
}
Please help, I've been at it for hours and can't find a solution
Upvotes: 3
Views: 2680
Reputation: 574
Change the plugin version in your project-level build.gradle file as follows:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
then Rebuild project
Upvotes: 0
Reputation: 3007
You can try my answer. And also restart Android Studio after following these steps.
Upvotes: 0
Reputation: 2455
Delete .gradle and .idea folder
And REBUILD
If that doesn't work, again delete .gradle and .idea folder
and RESTART
Upvotes: 0