Android already relies on a certain library, but it still prompts Cannot resolve symbol 'xxx', and no error is reported when running.

   Cannot resolve symbol ‘Theme’ in styles.xml (Android Studio)
    Failed to load AppCompat ActionBar with unknown error.
    Cannot resolve symbol ‘OkhttpUtils’

Sometimes the code will report Cannot resolve symbol 'xxx' for no reason, but the actual compilation will not report an error and it can run.
Solution:
1. Comment out the configuration of which Jar package has problems, such as the following:

dependencies {
    
     
  // implementation 'pub.devrel:easypermissions:2.0.1'
  //  implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.2.1'
}

2. Click Sync Now
Insert image description here

3. Then unpack the annotation

dependencies {
    
     
  implementation 'pub.devrel:easypermissions:2.0.1'
   implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.2.1'
}

4. Click Sync Now again

Guess you like

Origin blog.csdn.net/qq_38847655/article/details/123230646