Using Android studio to develop a collection of problems encountered

Source: Internet
Author: User
Tags android sdk manager

Transferred from: http://blog.csdn.net/yuxiangyunei/article/details/26682015

Issue one: After importing samples in the SDK, Messages prompts "Error:Cause:failed to find target android-19.0.1" Install the missing platform fro M the Android SDK Manager.

Cause: As installed, the Build-tools version comes with 19.0.3, and the example is created under 19.0.1.

Resolution: 1, use the SDK Manager to install the 19.0.1, 2, modify Project->app->build.gradle in the Buildtoolsversion "19.0.1" changed to Buildtoolsversion " 19.0.3 ".

In addition, if the sample is imported from the Internet, it is generally necessary to modify compilesdkversion to 19.

Issue two: After installing the new version of the JDK, the old version of the JDK is still used at compile time

Workaround: Adjust file->project structure->sdk location and File->other Settings->default Project in as in addition to updating JAVA_HOME environment variables STRUCTURE->SDK location.

Issue three: As in the Code editing window and at run time, Chinese display garbled

Solution: As the Code editing window garbled, only need to change the lower right corner of the IDE UTF-8 to GBK; runtime display garbled, 1, add compileoptions.encoding = "in Project->app->build.gradle GBK ". 2, can not be directly input in the layout file in Chinese, need to register in the R file, such as <activity android:label= "Chinese" > Changed to <activity android:label= "@string/chinese" Add <string name= "Chinese" > Chinese </string> in Strings.xml.

Issue four: As import engineering with JNI settings, compilation error

Workaround: General Eclipse Engineering, as can be imported directly. If there is a problem, confirm that the project is running well in Eclipse, export as engineering, and then import in as.

Question five: Invalid R-class path shown in Mainactivity.java

Workaround: As does not automatically generate R files for some reason. For example, if the project relies on a library file version that does not match the specified compilesdkversion, you need to manually specify the version number of the library file that needs to be compiled. For example, Android.compilesdkversion is 19, then add at the end of Project->app->build.gradle

dependencies {

Compile ' com.android.support:support-v4:+ ' changed to compile ' com.android.support:support-v4:19.+ '
Compile ' com.android.support:appcompat-v7:+ ' changed to compile ' com.android.support:appcompat-v7:19.+ '
}

Note dependencies{} and android{} siblings

Go on......

Using Android studio to develop a collection of problems encountered

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.