Android Studio Project Build FAQ Solution

Source: Internet
Author: User
Tags android sdk manager

1. After you create or import a project, you are waiting for it to compile

Problem:

Reason: As a network to download Gradle, but the network is not good or not through

Workaround: Disable the network, as will immediately automatically terminate the download into the main interface. At this time to specify the offline version of the gradle to compile;

2. Unknow Host ' services.gradle.org '

Problem:

Cause: When you import a third-party project, someone else's project uses a different version of Gradle than yours, and as will be connected to the Web to download the Gradle version, but cannot find the services.gradle.org server.

FIX: Do not have to download different Gradle version, you can specify Gradle as offline mode, use the Gradle version that you already exist.

3. Gradle DSL method not found: ' Android () '

Issue: Error: (0) Gradle DSL method not found: ' Android () '

Reason:

When you modify the compiled version and tools through project structure, the following script code is added to the project's Build.gradle file: This will cause the error above.

"23.0.0"}

Workaround: You should add the above code to the module's Build.gradle file and not to the project's Build.gradle file

4. Unable to find the compiled Android SDK version

Problem:

Cause: Unable to find the compiled Android SDK version

FIX: You can follow the prompts to open the Android SDK Manager to download the appropriate version,

But the best solution is to modify the compiled version to the version of the SDK you currently have.

You only need to modify the following version in the module's Build.gradle file:

5. Parsing a referenced third-party dependency failed

Workaround: Disable gradle offline operation mode, network to download dependent AAR.

6. Gradle plugin version is too low

Problem:

Reason:

This typically occurs when you import other people's projects, or after you have updated Android studio. The reason is that Android Studio is built on Gradle and uses the relevant Android Gradle plugin when building Android projects. Updates to Android studio and SDK may result in older versions of plugins being unavailable (for example, after the 19.0 version of build tools, Zipalign is moved from the tools directory to the corresponding version directory of build tools), so The new version of Android Studio will require a later version of the plugin to compile.

Workaround: View the version of your Gradle plugin in the following way, as specified in this version.

7. As import Eclipse project run to emulator display garbled

Re-set the encoding, remove the installation package, recompile the run;

8. The project is placed in the Chinese path error

Error Details:

Error: (9, 0) Your project path contains non-ascii characters. This is the most likely cause the build-to-fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can is disabled by using the command line flag-dcom.android.build.gradle.overridepathcheck=true, or adding t He line Com.android.build.gradle.overridepathcheck=true ' to gradle.properties file in the project directory.

Description: The item cannot be placed under the Chinese path, otherwise the error may appear.

Solve:

Method One: The path does not have Chinese

Method Two:

In the C:\Users\Administrator\.gradle directory, add the following setting in the file Gradle.properties (created if the file does not exist):

Com.android.build.gradle.overridepathcheck=true

9. Gradle ' xxx ' project refresh failed?

Open the settings search Gradle and then in the Gradle VM options input-xmx512m or-xmx768m;

10. Error in Layout file preview after creating project

As shown below:

Api 23 uses toolbar instead of Actionbar, and the topic can't find Actionbar, so something went wrong.

How to resolve:

Put the following default theme in Sytles.xml:

<style name= "Apptheme" parent= "Theme.AppCompat.Light.DarkActionBar" >

Modify into Base.Theme.AppCompat.Light.DarkActionBar

Or: Theme.AppCompat.Light.NoActionBar

Androidstudio Compiling picture error

Androidstudio to the picture format requirements are strict, such as some of the old points of the picture, or the format of the non-standard PNG images, may be due to the picture format causes Androidstudio compilation error

SDK23 Compile report httpclient error

Solve:

The Android SDK23 version removes the httpclient from the SDK, and if you use it,

You need to manually add the Httclient jar package:

Multiple Dex file

Android_daily_override value is also outdated

Error: (1, 0) Plugin is too old and android_daily_override value are also outdated, please use new value: "41b72d353033bfb5a A4d6a98088a908dcae15ef9 "

<a href= "Openfile:d:\workspace_studio\as\materialdesign\app\build.gradle" >open File</a>

Solve:

Restart studio after adding system environment variables

Environment variable: android_daily_override, Value: 41B72D353033BFB5AA4D6A98088A908DCAE15EF9

. JUnit causes an error

WORKAROUND: Since no Java unit test is used to delete the row reference from the app's Build.gradle file

Android Studio Project Build FAQ Solution

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.