About Android Studio loading third party jar package cannot be compiled to solve

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Android Studio has just released, I believe many of my friends and me, began to develop the project, but the new things will encounter this or that kind of problems, most of which I head is the introduction of third party jar package cannot be compiled, because it is something new, relevant information is less, solve the problem that I it took a very long time, in order to avoid colleagues detours, this will solve the steps listed.

1,The jar packet into the project's LIBS folder.

2,Select the jar package in the project right click"Add as library".

3,The two step is relatively easy to find online, but the project is still unable to compile, will appear:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ABetone:compileDebug'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

  When required in the project build.gradle files in the dependencies entry

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('libs/xxxx.jar')

4,The project to compile and run the code, but when you actually create references to jar instances, it is possible that the system will throw an exception NoClassDefFoundError, this time can be according to the following steps:

  Through the above operation, should be able to solve the problem. PS: I is the Windows system, Linux system and Max path gradlew command may not the same.

We hope the above can help you solve the problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Emily at November 19, 2013 - 8:29 PM