升级gradle插件后,java gradle项目同步仍失败
Gradle项目同步失败,未从其他相关问题中获得答案。以下是我的详细情况
初始同步尝试产生以下错误消息:
Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
我有Android Studio 3.0。建造。gradle文件包含以下依赖项:
classpath 'com.安卓.tools.build:gradle-experimental:0.2.1'
The gradle-wrapper.properties file includes the following distribution URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
根据https://developer.安卓.com/studio/build/gradle-plugin-3-0-0-migration.html#update_gradle我需要做一些改变
首先,在Gradle wrapper中更新Android Studio 3.0的Gradle版本。属性:
分配=\ https://services.gradle.org/distributions/gradle-4.1-all.zip (我认为等号后面的反斜杠是一个错误,并没有做出改变。)
第二步,添加以下要构建的buildscript存储库。格雷德尔:
谷歌()
第三个,更改构建。渐变依赖性:
classpath'com。安卓工具。建造:渐变:3.0.1'
第二个和第三个变化适用于最新版本的Android插件
当我在这些更改后尝试同步时,会再次失败,并出现以下新错误:
id为'com的插件。安卓模型找不到应用程序
该错误涉及构建的第一行。格雷德尔:
应用插件:com。安卓模型申请
发生了什么,为什么?我最近在Android Studio中添加了NDK。我正在尝试同步的项目包含C代码。我不能完全确定我添加的NDK是否正确。我想知道这是否是问题的一部分
# 1 楼答案
你应该改变你}
dependencies
{所有步骤都在这里:
classpath 'com.android.tools.build:gradle:1.3.0'
到classpath 'com.android.tools.build:gradle:2.3.2'
'Try Again'
'Fix Gradle Wrapper and re-import project'
单击该按钮,因为最小的gradle版本是3.3
The SDK Build Tools revision (23.0.1) is too low for project ':app'. Minimum required is 25.0.0
-HitUpdate Build Tools version and sync project
Android Gradle Plugin Update recommended
,只需从那里更新即可李>现在这个项目应该可以在你的任何android虚拟设备上运行了
# 2 楼答案
进入你的身体。升级或更新版本
# 3 楼答案
首先,
gradle-wrapper.properties
是不正确的。您必须在其中包含\
。应该是这样的:然后,将实验类路径添加到项目构建中。格雷德尔。比如:
查看Experimental Plugin User Guide以了解详细信息