Why can't AndroidStudio recognize the retrofit package specified in gradle?

1. Description of the problem:
recently upgraded AndroidStudio to the latest 3.1.2 version in the project gradle and added several external packages including Apache httpcomponent, Google gson, squareup retrofit and converter-gson,gradle for sync and build operations without any errors, but when writing import com.squareup.retrofit2 in the project, the build project will report an error, and import com.google.gson / import com.apache.http can be used normally.

2. Related code:

    implementation "com.google.code.gson:gson:2.8.5"
    implementation group: "org.apache.httpcomponents" , name: "httpclient-android" , version: "4.3.5.1"
    implementation "com.squareup.retrofit2:retrofit:2.4.0"

3. Error message:

Java Compiler:
       : com.squareup

4. Screenshot

5. Try it:
download the compiled jar file and put it in the libs directory and change the .gradle file to implementation files: ("libs/retrofit-2.4.0.jar") the problem remains.


because its package name is not the
clipboard.png

that you wrote.
Menu