问题
I am trying to add external libraries(httpmime-4.0-sources.jar) to android project irked by the fact that android-studio is popping up errors like
- error: package org.apache.http.entity.mime does not exist
- error:cannot find symbol class MultipartEntity
- error: cannot find symbol class HttpMultipartMode
I need help.
As a practice I copied the jar file to the lib folder and added that as a library. But the error does not go away.
回答1:
Step wise
- Copy JAR File to libs Folder
- Register module in build.gradle file, instructions for which are given in steps 3 through 9
- Open file menu and click on project structure
- Now in Project Structure dialog box select app under module
- Now Click on Dependencies tab in project structure dialog
- Click on + sign in right side corner
- Select File Dependency from list
- Select jar file from libs folder
- Click apply and Ok
- Finally click on sync gradle button
One more thing, check for proxy connection if you are using it.
回答2:
First copy your library in libs folder and then add this dependency in build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
......
}
来源:https://stackoverflow.com/questions/38456501/how-to-add-external-dependencies-jar-file-to-android-studio