Update your Android Studio 3.0 encounter problems

Source: Internet
Author: User

After the update, try to run the maintenance of the old project, there are various errors, because later found that the problem is not here, so did not remember the complete, probably as follows:

A larger heap for the Gradle daemon was recommended for running Jack.

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

Then look at Gradle.properties my Org.gradle.jvmargs is already 2048, and there's another error:unexpected top-level error: wrong

Search for a bit and did not find the point, so build a project, prompting

error:failed to complete Gradle execution.

Cause:
The version of Gradle you is using (3.3) does not support the Fortasks () method on Buildactionexecuter. The available in Gradle 3.5 and all later versions.

So update use Gradle the latest version, create a new project to see what version of the default, modify the following files

Gradle-wrapper.properties.

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

In the app's Build.gradle

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

Wrong after compiling

Cannot set the value of Read-only property ' OutputFile ' ....

Because the code that uses the compiled output file name

Applicationvariants.all {variant-Variant.outputs.each {Output-def OutputFile=output.outputfile def fileNameif(OutputFile! =NULL&& outputFile.name.endsWith ('. apk '))) {            if(Variant.buildType.name.equals (' release '))) {                //output apk name is called Test_v_1.0_15-09-15 11:12:32_official_release.apkFileName = "Test_v_${defaultconfig.versionname}_${releasetime ()}_${variant.productflavors[0].name}_release.apk"            } Else if(Variant.buildType.name.equals (' Debug ')) {                //output apk name is called Test_v_1.0_15-09-15 11:12:32_official_debug.apkFileName = "Test_v_${defaultconfig.versionname}_${releasetime ()}_${variant.productflavors[0].name}_debug.apk"} output.outputfile=NewFile (outputfile.parent, FileName) }}}

Error in the last line, should be the new version of Gradle problem, finally find a solution in Stackover flow, reference

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

Change the Variant.outputs.each into

Variant.outputs.all

The last line is changed to

OutputFileName = FileName

Continue compiling continue 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 found the following articles, modified to be able to compile and run the normal

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

I've seen a few articles and I don't know what this is, according to the build.gradle of the project.

defaultconfig {    targetsdkversion:* * *    minsdkversion:* * *    versioncode:* *     versionname:* * *    // add a sentence after the version name, meaning that flavor dimension its dimension is the version number, so that the dimensions are all unified    Flavordimensions "Versioncode"}

The other code of the project does not have to change, the article at the beginning of the error is all gone, fortunately not wasted too much time

Update your Android Studio 3.0 encounter problems

Related Article

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.