我已经将我的应用程序从 gradle 2.13 更新到 4.1,将 Android Studio 版本 2.1.2 更新到 3.0.0,但是在构建应用程序时,应用程序无法运行并显示错误:未知的安卓属性"夏洛克旋转器">
在更新 gradle 和安卓 stuido 版本时,我还更改了 gradle 中的输出 APK 文件名:
老:
applicationVariants.all { variant ->
variant.outputs.all { output ->
def file = output.outputFile
output.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
}
}
最新:
applicationVariants.all { variant ->
variant.outputs.all { output ->
def file = output.outputFile
output.outputFileName = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
}
}
此更改是此错误的根本原因吗?我该怎么办?
在build.gradle
文件中添加以下依赖项
ependencies {
...
compile 'com.sherlockshi.widget:sherlockspinner:1.0.2'
}
错误就在那里,您的项目缺少上述依赖项,因此无法成功构建。您可能已在 java 文件中导入了该类