Cannot resolve symbol 'MultiDex'

cannot resolve symbol intellij
intellij cannot resolve symbol gradle
"cannot resolve symbol r" intellij
cannot resolve symbol c#
cannot resolve symbol string intellij
cannot resolve symbol apache intellij scala
cannot resolve symbol hudson
cannot resolve symbol immutable

I'm trying to enable MultiDex. I added multiDexEnabled true and compile 'com.android.support:multidex:1.0.3' to build.gradle. I made a java file

public class ApplicationClass extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);  // <----------
    }
}

and added android:name=".ApplicationClass" to manifest file.

But in the java file, in MultiDex.install(this); the MultiDex part is red and it says Cannot resolve symbol 'MultiDex'. And gradle sync fails. I also tried adding android:name="android.support.multidex.MultiDexApplication" to manifest, instead of creating the java file and extending application class. It didn't work either. The part MultiDexApplication is red and it says unresolved class 'MultiDexApplication'

I think there is something wrong with the android support library in my system. Multidex is from this library. Also when I change any of 'com.android.support:appcompat-v7:26.+' (to the specific version 26.0.1 as suggested by Android Studio) or 'com.android.support.constraint:constraint-layout:1.0.2' (to the newer version 1.1.2), gradle sync fails.

I looked into <SDK>/extras directory. And I see there are three different support directories. Not sure if this has something to do with the problem.

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.vvaezian.multilingovocabularypractice"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true    <--- added ---
    }
    buildTypes {
        debug {
            buildConfigField 'String', "ApiKey", MultiLingo_ApiKey
        }
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField 'String', "ApiKey", MultiLingo_ApiKey
        }
    }

    packagingOptions {
        exclude 'project.properties'
        exclude 'META-INF/INDEX.LIST'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.okhttp3:okhttp:3.8.0'

    implementation('com.google.cloud:google-cloud-translate:1.3.1') {
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'org.json', module: 'json'
    }
    annotationProcessor 'com.google.cloud:google-cloud-translate:1.3.1'
    compile 'com.android.support:multidex:1.0.3'  // <----- added ----
    // using 'implementation' instead of 'compile' didn't resolve the issue
}

Also the log file does not say why the gradle sync fails. There is only one line that says Too many events posted ...

2018-08-01 13:56:54,922 [e-1024-b01]   INFO - e.project.sync.GradleSyncState - Started sync with Gradle for project 'MultiLingoVocabularyPractice'. 
2018-08-01 13:56:54,924 [e-1024-b01]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: SYNC_STARTED 
2018-08-01 13:56:54,924 [e-1024-b01]   INFO - idea.project.IndexingSuspender - Starting batch update for project: Project '/local-scratch/vvaezian/AndroidStudioProjects/MultiLingoVocabularyPractice' MultiLingoVocabularyPractice 
2018-08-01 13:56:54,934 [hread 1914]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /local-scratch/vvaezian/android-studio/jre 
2018-08-01 13:56:54,935 [hread 1914]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /local-scratch/vvaezian/android-studio/jre 
2018-08-01 13:56:54,943 [hread 1914]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: -Didea.version=3.1 -Djava.awt.headless=true -Pandroid.injected.build.model.only=true -Pandroid.injected.build.model.only.advanced=true -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.build.model.only.versioned=3 -Pandroid.injected.studio.version=3.1.3.0 -Pandroid.builder.sdkDownload=false --init-script /tmp/ijinit.gradle 
2018-08-01 13:56:57,640 [hread 1916]   INFO - agnostic.FrequentEventDetector - Too many events posted, #7. Event: java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=LaterInvocator.FlushQueue,notifier=null,catchExceptions=false,when=1533157017640] on sun.awt.X11.XToolkit@5b185819 
2018-08-01 13:56:57,676 [hread 1914]   INFO - e.project.sync.GradleSyncState - Started setup of project 'MultiLingoVocabularyPractice'. 
2018-08-01 13:56:57,677 [e-1024-b01]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: SETUP_STARTED 
2018-08-01 13:56:57,789 [hread 1916]   INFO - idea.project.IndexingSuspender - Indexing suspended (context: Project Setup) 
2018-08-01 13:56:57,995 [e-1024-b01]   INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 26 Platform (1)' (/local-scratch/vvaezian/SDK) to module 'app' 
2018-08-01 13:56:58,005 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/build-tools/26.0.1/package.xml 
2018-08-01 13:56:58,009 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/build-tools/27.0.3/package.xml 
2018-08-01 13:56:58,012 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/emulator/package.xml 
2018-08-01 13:56:58,016 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/extras/android/m2repository/package.xml 
2018-08-01 13:56:58,020 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/extras/google/m2repository/package.xml 
2018-08-01 13:56:58,024 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2/package.xml 
2018-08-01 13:56:58,028 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2/package.xml 
2018-08-01 13:56:58,032 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/patcher/v4/package.xml 
2018-08-01 13:56:58,035 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/platform-tools/package.xml 
2018-08-01 13:56:58,039 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/platforms/android-23/package.xml 
2018-08-01 13:56:58,042 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/platforms/android-24/package.xml 
2018-08-01 13:56:58,045 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/platforms/android-25/package.xml 
2018-08-01 13:56:58,049 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/platforms/android-26/package.xml 
2018-08-01 13:56:58,053 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/sources/android-26/package.xml 
2018-08-01 13:56:58,056 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/system-images/android-24/google_apis_playstore/x86/package.xml 
2018-08-01 13:56:58,060 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/system-images/android-26/google_apis/x86/package.xml 
2018-08-01 13:56:58,063 [hread 1917]   INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/tools/package.xml 
2018-08-01 13:56:58,118 [hread 1914]   INFO - e.project.sync.GradleSyncState - Gradle sync failed (3s 196ms) 
2018-08-01 13:56:58,120 [e-1024-b01]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender deactivation event: SYNC_FINISHED 
2018-08-01 13:56:58,120 [e-1024-b01]   INFO - idea.project.IndexingSuspender - Finishing batch update for project: Project '/local-scratch/vvaezian/AndroidStudioProjects/MultiLingoVocabularyPractice' MultiLingoVocabularyPractice 
2018-08-01 13:56:58,150 [e-1024-b01]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-08-01 13:56:58,169 [hread 1916]   INFO - idea.project.IndexingSuspender - Indexing released (context: Project Setup) 
2018-08-01 13:56:58,199 [hread 1916]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 2ms; general responsiveness: ok; EDT responsiveness: ok 
2018-08-01 13:56:58,254 [hread 1916]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 55ms; general responsiveness: ok; EDT responsiveness: ok 
2018-08-01 13:56:58,303 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s. 
2018-08-01 13:56:58,304 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Building symbols in FAST mode, 0 source files from total 0 project files 
2018-08-01 13:56:58,305 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Loading Module Maps finished in 0 s. 
2018-08-01 13:56:58,305 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Saving Module Maps finished in 0 s. 
2018-08-01 13:56:58,305 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Saving Module Maps finished in 0 s. 
2018-08-01 13:56:58,305 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Loaded 0 tables for 0 files (0 project files) 
2018-08-01 13:56:58,305 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 source files 
2018-08-01 13:56:58,306 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 unused headers 
2018-08-01 13:56:58,307 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Building symbols finished in 0 s. 
2018-08-01 13:56:58,307 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Saving modified symbols for 0 files (0 tables of total 0) 
2018-08-01 13:56:58,307 [hread 1916]   INFO -       #com.jetbrains.cidr.lang - Saving symbols finished in 0 s. 

Multidex problems occurs when there are dependencies in gradle that needs to be updated or you have dependencies with different version number in test compile. So, you needs to make sure first about dependencies updated version numbers. Your problem will be solved, if there will be version number issue.

how to overcome Android Studio cannot resolve symbol for android , In the menu bar. Select tools>-android>-SDK manager. and download the SDK build tools, SDK platform and Google API's( the Google API  If your code uses this class, the exception on the IDE "Cannot resolve symbol 'Activity Manager'" will appear due to the absence of importing the related class. This class can be imported in your class with the following line at the top of your class: import android.app.ActivityManager;

Seeing that you are supporting minimal sdk version 15 (Android 4.0.3)

minSdkVersion 15

According to https://developer.android.com/studio/build/multidex, you need to change

implementation 'com.android.support:multidex:1.0.3'  

to

compile 'com.android.support:multidex:1.0.3' 

Because, the implementation style is for Multidex support after Android 5.0.

Cannot resolve symbol – IDEs Support (IntelliJ Platform), I've run into a bizarre problem where IDEA tells me that it cannot resolve symbol for classes within the same package as the class open If still facing the issue – “ How to solve cannot resolve symbol r in the Android Studio “, then comment in below. And any other solution you have, then comment. We will update in this tutorial. Note: This example (Project) is developed in Android Studio 3.3.2. Tested on Android 9 ( Android-P),

import android.support.multidex.MultiDex;

"Cannot resolve symbol" errors occur when you include the Mobile , xml) file, if you hover over the application activities for Mobile Quality Assurance, the Cannot resolve symbol error message displays for each  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Android Studio: Cannot resolve symbol 'raw'

Java compiler errors: "cannot resolve symbol" and "symbol : variable , TestRT: Java compiler errors: "cannot resolve symbol" and "symbol : variable rational" occur when building a project. IntelliJ "Cannot resolve symbol", but jar is present in libraries Follow. I am having a new issue with IJ, in that it will not resolve symbols that are defined in a local jar. This is a jar I build from another project of ours.

The source of the problem was that I had deleted the folder example in the package structure com.example.vvaezian.multilingovocabularypractice but had forgotten to make the change in gradle file

defaultConfig {
    applicationId "com.example.vvaezian.multilingovocabularypractice"
    ...
}

Also I commented out buildToolsVersion "26.0.1".

How to fix IntelliJ cannot resolve symbol, Ever since copying a Gradle project from one computer to another I have been getting 'cannot resolve symbol String' and similar messages in  However, in Android studio, anything referencing that library shows "cannot resolve symbol" and displays in red. What do I need to do to get Android Studio to recognize the library? I have already tried rebuilding the project, ./gradlew clean, and closing and re-opening my project.

cannot resolve symbol, source code. The causes for this common error include: A missing class file. A faulty CLASSPATH. Cannot resolve symbol 'java'. And all the java packages aren't recognized ('java' is shown in red for import java.util). I have jdk 1.4.2, 1.5 and 1.6 installed, each one set up in intellij, and I get the same problem when I choose them for the project.

"Cannot Find Symbol" compile error, that you have used a name that the compiler was not able to recognize. The ID's of the Text and Button (R.id) are correct, but when my mouse is over TextView or Button, it says: "Cannot resolve Symbol". Any solutions? Newbie in Android Development over here :P. Thanks! PD: Here is the XML. <

Solved, In this video you'll learn how to fix "cannot resolve symbol" error in Android Studio​. The Duration: 1:05 Posted: Apr 16, 2016

Comments
  • Can you please give more details on what exactly do I need to do. As I noted in the post when I change any of 'com.android.support:appcompat-v7:26.+' (to the specific version 26.0.1 as suggested by Android Studio) or 'com.android.support.constraint:constraint-layout:1.0.2' (to the newer version 1.1.2), gradle sync fails. Also I added the log file.
  • It seems the issue of your sdk path. 'com.android.support:appcompat-v7:26.0.1'. In your logcat, while setting SDK 2018-08-01 13:56:58,005 [hread 1917] INFO - s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/build-tools/26.0.1/package.xml 2018-08-01 13:56:58,009 [hread 1917] INFO s.RepoProgressIndicatorAdapter - Parsing /local-scratch/vvaezian/SDK/build-tools/27.0.3/package.xml It sets two different versions of SDK build-tools. This may cause of problem
  • Thanks. But it didn't resolve the issue. I added logs as well.
  • The log looks not related with your red package name issue.
  • it will be good if you an upload a minimal subset of your project so that i can investigate more details.
  • I changed back to implementation as it was warning compile is deprecated.
  • I can't believe you suggested that OP should change implementation to compile and got a upvote for the answer.