Android Studio Three ways to import external resources and error handling

Source: Internet
Author: User

Android Studio provides three ways of importing external resources:

1. Library Dependency – Online Add, Internet download required

2. File Dependency – add some jar packages locally (to copy the jar package to the project's Libs folder first)

3. Module Dependency – Add a library project with source code locally (to import moudle the library project into the project first)


The third way, the import will report some errors, here is the open source framework android-async-http on GitHub, for example, give an import step and try to resolve the error.

import by using import Moudle

This is the first choice to import the library, the original name: library to: android_async_http_library, easy to distinguish when the library is more

error after import :

notreadscriptasitdoesnot exist.

Workaround:

    1. Cut into the project structure after import (see)

    2. Open the Build.gradle file for the imported library and apply the From: '. /maven_push.gradle ' this line to comment off, sync a bit OK.

      from‘../maven_push.gradle‘

      PS: This library in the Build.gradle file, the SDK compiled version is exactly the same as mine, if not consistent, will also error, the SDK compiled version of its own compiled version of the line.

      22‘22.0.1‘

      Here, the external repository is imported and completed.

The case of the Library project is imported in the same way.

After the import still error, and import the same as the library errors.

Workaround:

    1. Find the following line:

      project(‘:library‘)

      Will: the library changed to: android_async_http_library, sync a bit.

      project(‘:android_async_http_library‘)

PS: To this library project sample, with some jar package, in the synchronization will be automatically downloaded, patience and so will be imported successfully.

Look at the project structure after the success:

Happy ~ ~

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Studio Three ways to import external resources and error handling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.