3

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

Ben
  • 706
  • 7
  • 11
  • Did you manage to resolve this problem? Think I have the same problem and I've been scratching my head for hours – WillEllis Dec 17 '17 at 21:57
  • No, unfortunately i didn't find a way to solve this, I ended up creating a new project and copying the classes and resources to that new project and everything works fine now. it's quite the workaround, but i can continue working on it now. – Ben Dec 18 '17 at 22:20
  • Eek, that is not the response i was hoping for! Thanks for getting back to me though! – WillEllis Dec 19 '17 at 21:40

3 Answers3

0

Delete .gradle and .idea folder

And REBUILD

If that doesn't work, again delete .gradle and .idea folder

and RESTART

DELETE THIS

Ajay Shrestha
  • 2,433
  • 1
  • 21
  • 25
0

You can try my answer. And also restart Android Studio after following these steps.

Aman Gupta - ΔMΔN
  • 2,971
  • 2
  • 19
  • 39
0

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

Deepak Kataria
  • 554
  • 3
  • 10
  • this might help https://stackoverflow.com/questions/197986/what-causes-javac-to-issue-the-uses-unchecked-or-unsafe-operations-warning – Deepak Kataria Nov 09 '17 at 08:14