How to add external dependencies (jar file) to and

2019-04-09 05:22发布

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.

2条回答
Viruses.
2楼-- · 2019-04-09 05:31

First copy your library in libs folder and then add this dependency in build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ......
}
查看更多
爷、活的狠高调
3楼-- · 2019-04-09 05:45

Step wise

  1. Copy JAR File to libs Folder
  2. Register module in build.gradle file, instructions for which are given in steps 3 through 9
  3. Open file menu and click on project structure
  4. Now in Project Structure dialog box select app under module
  5. Now Click on Dependencies tab in project structure dialog
  6. Click on + sign in right side corner
  7. Select File Dependency from list
  8. Select jar file from libs folder
  9. Click apply and Ok
  10. Finally click on sync gradle button

One more thing, check for proxy connection if you are using it.

查看更多
登录 后发表回答