Android Studio 3.0 is updated.

Source: Internet
Author: User

Android Studio 3.0 is updated.

After the update, try to run the old project that is being maintained, and there are various errors, because the problem is not found here, so I did not remember it completely, probably as follows:

A larger heap for the Gradle daemon is recommended for running jack.

It currently has 512 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org. gradle. jvmargs =-Xmx1536M in the project gradle. properties.

Check that my org. gradle. jvmargs of gradle. properties is 2048, and there is an Error: unexpected top-level error: Error.

After searching, the key points are not found, so Build the project and prompt

Error: Failed to complete Gradle execution.

Cause:
The version of Gradle you are using (3.3) does not support the forTasks () method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

Then update and use the latest version of Gradle. Create a new project and check the default version. Modify the following files:

In the gradle-wrapper.properties

DistributionUrl = https \: // services.gradle.org/distributions/gradle-4.1-all.zip

 

In APP build. gradle

Dependencies {
Classpath 'com. android. tools. build: gradle: 3.0.0'
}

 

 

An error occurs after compilation.

Cannot set the value of read-only property 'outputfile '....

Because the code for compiling the output file name is used

ApplicationVariants. all {variant-> variant. outputs. each {output-> def outputFile = output. outputFile def fileName if (outputFile! = Null & outputFile.name.endsWith('.apk ') {if (variant. buildType. name. equals ('release') {// The output apk name is Test_v_1.0_15-09-15 11:12:32 _official_release.apk fileName = "inline"} else if (variant. buildType. name. equals ('debug') {// The output apk name is Test_v_1.0_15-09-15 11:12:32 _official_debug.apk fileName = "success"} output. outputFile = new File (outputFile. parent, fileName )}}}

The error is in the last line. It should be caused by the new version of Gradle. Finally, find the solution in Stackover Flow. Refer

Https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property

Change variant. outputs. each

Variant. outputs. all

Change the last line

OutputFileName = fileName

 

 

Continue compilation Error

Error: All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

Baidu finds the following article and can compile and run it properly after modification.

Http://blog.csdn.net/syif88/article/details/75009663

After reading a few articles, I cannot figure out what this is. Follow the instructions in build. gradle of the project.

DefaultConfig {targetSdkVersion: *** minSdkVersion: *** versionCode: *** versionName: *** // Add a sentence after the version name, this indicates flavor dimension. The dimension is the version number. In this way, all dimensions are consistent. flavorDimensions "versionCode "}

 

You don't need to change other code of the Project. All the errors at the beginning of the article are lost. Fortunately, you didn't waste too much time.

 

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.