Summary of problems encountered in updating Android studio 3.0
After the update, try to run the old project under maintenance. Various errors occurred. It was later found that the problem was not here, so it was not recorded completely. It is roughly 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.
Then check gradle.properties. My org.gradle.jvmargs is 2048, and there is another error: unexpected top-level error:
After searching, I didn't find the key points, so I built the project and prompted
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.
So update and use the latest version of gradle, create a new project, see what version is used by default, and modify the following files
Gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
In build.gradle of app
Error after compilation
Cannot set the value of read-only property 'outputFile'....
Because the code that compiles the output file name is used
The error is in the last line. It should be the problem of the new gradle. Finally, find a solution in stackover flow. Refer to
https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property
Change variant.outputs.each to
variant.outputs.all
Change the last line to
outputFileName = fileName
Error continuing compilation
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, which can be compiled and run normally after modification
https://www.oudahe.com/p/41224/
After reading several articles, I don't know what this comes from. Follow the build.gradle of the project
Other codes of the project do not need to be changed. All the mistakes at the beginning of the article are gone. Fortunately, I didn't waste too much time
PS: let's take a look at a compilation problem encountered after updating Android studio to 3.0
Android studio was updated tonight, but a compilation problem was found when using this:
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution Failed for task ':app:mergeDebugResources'. > Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Through Google, we found the solution:
Add in gradle.properties of the project
android.enableAapt2=false
I don't know why yet. Let's stay here first
summary
The above is a summary of the problems encountered in updating Android studio 3.0 introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!