小编Ole*_*nov的帖子

推断Nullity永远运行

当我在android studio菜单中选择Analyze - Infer nullity ...并选择任何范围(甚至尝试在单个文件上运行)时弹出消息并说:

模块...没有引用现有的带有Android无效注释的"support-annotations"库.你想现在添加依赖吗?

我单击"确定",然后开始同步开始,并显示带有"推断无效注释"标题的进度条.然后它会像这样永远运行

我尝试在gradle中手动添加:

compile 'com.android.support:support-annotations:23.4.0'
Run Code Online (Sandbox Code Playgroud)

但仍然有相同的结果.

android intellij-idea android-studio

10
推荐指数
1
解决办法
266
查看次数

为什么assembleDebug比项目构建需要更长的时间以及如何优化它?

我最近一直在处理Android Studio中的gradle构建时间.通过删除一些依赖项,我已经设法将构建时间从大约3分钟减少到10秒,但事情就是这样:

当我重建项目时,大约需要10秒钟:

15:13:43 Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]
15:13:54 Gradle build finished in 11s 596ms
Run Code Online (Sandbox Code Playgroud)

但是,当我启动应用程序时,需要更长的时间,大约一分钟:

15:15:09 Executing tasks: [:app:assembleDebug]
15:15:58 Gradle build finished in 49s 676ms
Run Code Online (Sandbox Code Playgroud)

造成这么大差异的原因是什么?这仍然是因为大量的gradle依赖或其他东西?我能以某种方式减少构建时间吗?

android gradle android-studio

8
推荐指数
1
解决办法
3576
查看次数

无法更新build.gradle以使用支持库23.0.1

所以我更新了build.gradle文件:

compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
Run Code Online (Sandbox Code Playgroud)

但当我尝试同步项目时,会弹出

Error:(25, 13) Failed to resolve: com.android.support:recyclerview-v7:23.0.1
Install Repository and sync project
Show in File
Show in Project Structure dialog
Run Code Online (Sandbox Code Playgroud)

(对于其他两个存储库也是如此)

然后我尝试单击"安装存储库并同步项目",并发生以下错误:

Ignoring unknown package filter 'extra-android-m2repository'Warning: 
The package filter removed all packages. There is nothing to install.
         Please consider trying to update again without a package filter.
Run Code Online (Sandbox Code Playgroud)

安装失败.

我已经在SDK管理器中安装了构建工具23.0.1以及android M的所有内容.尝试回滚到23.0.0,但它是一样的.

怎么了?这个包过滤器来自哪里?在发生此错误之前,我不认为我更改了除build.gradle之外的任何内容

编辑:我试图删除构建工具并再次安装它们,同时安装SDK管理器日志弹出:

Preparing to install archives
Downloading Android SDK Platform-tools, revision 23.0.1
Installing Android SDK Platform-tools, revision 23.0.1
*** -> …
Run Code Online (Sandbox Code Playgroud)

sdk android gradle

7
推荐指数
1
解决办法
3万
查看次数

PreferenceFragment不会显示在Activity中

我已经按照android开发人员的指南"设置"进行了操作.但是当我启动我的SettingsActivity时,我得到的只是白屏.我究竟做错了什么?

这是我的SettingActivity.java

public class SettingsActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getFragmentManager().beginTransaction()
                 .replace(android.R.id.content, new SettingsFragment())
                 .commit();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是SettingFragment

public class SettingsFragment extends PreferenceFragment {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是首选项文件

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <EditTextPreference android:title="Your Name"
        android:key="username"
        android:summary="Please provide your username"></EditTextPreference>
    <CheckBoxPreference android:title="Application Updates"
        android:defaultValue="false"
        android:summary="This option if selected will allow the application to check for latest versions."
        android:key="applicationUpdates" />
    <ListPreference     android:title="Download Details"
        android:summary="Select the kind of data that …
Run Code Online (Sandbox Code Playgroud)

settings android preferences

6
推荐指数
1
解决办法
1万
查看次数

Google映射android api:移动罗盘按钮

我看到可以为UI设置边距,也可以禁用按钮.

但是我们可以将罗盘按钮移动到不同的位置而不是左上角吗?

谷歌地图应用程序将它放在右上角,这让我觉得它是可能的.

google-maps google-maps-android-api-2

6
推荐指数
1
解决办法
1959
查看次数

在mac上找不到/ dev/kvm

所以我一直在我的Mac上使用android studio 2.0 beta,AVD工作正常.

但后来我注意到android studio现在无法启动AVD.它说没有找到/ dev/kvm.在您的BIOS安全设置中启用VT-x,确保您的Linux发行版具有正常工作的kvm模块.

在此输入图像描述

问题是:我根本没有触摸BIOS设置.可能的原因 :

  • VMWare - 在我注意到错误之前,我正在玩虚拟机并为vm配置新网络.
  • CleanMyMac - 我也用这个应用程序来清理系统
  • 其他原因是可能的,但我从未进入BIOS或触摸过系统设置

解决这个问题的解决方案我发现都是指Linux而不是Mac.我该如何解决这个问题?

编辑:

我重新安装了OS X(没有格式化硬盘).那没用.

macos virtual-machine android-virtual-device android-studio

6
推荐指数
2
解决办法
1万
查看次数

检查图像是否为纯白色?

我需要检查具有恒定大小(512x512 像素)的 PNG 图像是否只有白色像素而没有其他像素。

有没有一种简单的方法可以做到这一点,最好不要手动检查每个像素?也许使用 ImageMagick?

c# imagemagick

5
推荐指数
1
解决办法
3793
查看次数