我使用最新的 Android Studio (0.8.2)。在我的另一台 PC 上,成功构建了相同的代码。
这意味着构建脚本是正确的。
所以我假设它与 Gradle 配置有关,但我再次检查了所有配置:

我想念什么?
笔记!我没有指定 '--daemon' 选项。或者我只这么认为:( 我在 Gradle 默认和项目特定设置中找不到它
此外,我在工作室中创建了全新的项目。它没有帮助 - 同样的错误(
从4开始,我想使用下一个代码为所有Android API应用SharedPreferences.
/**
* The apply method was introduced
* in Android API level 9.<br> Calling it causes a safe asynchronous write
* of the SharedPreferences.Editor object to be performed. Because
* it is asynchronous, it is the preferred technique for saving SharedPreferences.<br>
* So we should use appropriate method if we doesn`t need confirmation of success.
* In this case we should use old commit method.
*/
@TargetApi(9)
public static void applySharedPreferences(SharedPreferences.Editor editor){
if (Build.VERSION.SDK_INT < 9){
editor.commit();
} …Run Code Online (Sandbox Code Playgroud)