测试支持图书馆Android Studio中源 [英] sources of Testing Support Library in Android Studio

查看:407
本文介绍了测试支持图书馆Android Studio中源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何安装从 android.support.test来源。* 在AS调试?结果
从尝试 https://android.googlesource.com/platform/frameworks/testing 下载源但版本似乎并不符合我的测试库版本。

How to attach sources from android.support.test.* for debugging in AS?
Tried downloading sources from https://android.googlesource.com/platform/frameworks/testing but the version doesn't seem to match my testing library version.

测试源(例如 AndroidJunitRunner )似乎并没有被通过SDK管理器中提供,我失去的东西吗?

Testing sources (for instance AndroidJunitRunner) don't seem to be available via sdk manager, am I missing something ?

推荐答案

我遇到过类似的问题,花时间相当量来弄明白。这似乎是一个错误,由于未执行缺少摇篮的任务,因为用于工作,但相同的配置没有任何更多之后升级到V1.2 AS +

I encountered a similar problem and it took a quite amount of time to figure it out. It seems like a bug due to a missing Gradle task not executed because the SAME configuration used to work but not any more after upgrading to AS v1.2+.

首先,下面的依赖已经过时了。

First, the following dependency is obsolete.

androidTestCompile 'com.android.support.test:testing-support-lib:0.1'

和它作为文档更新如下。

androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
...

该defaultConfig应包括以下行照常进行。

The defaultConfig should include the following line as usual.

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

此外,确保Android的支持库是通过SDK管理器安装。

Also, make sure the Android Support Repository is installed through the SDK Manager.

如果android.support.test *不能得到解决,那么手动如下执行摇篮任务。

If android.support.test.* cannot be resolved, then manually execute the Gradle task as follows.


  1. 单击右侧的摇篮标签。

  2. 收起你的Andr​​oid模块眉头任务节点。

  3. 双击执行其它 - > generateDebugAndroidTestSources

如果成功,该问题可能得到解决。至少,它为我工作。

If succeeded, the issue may be solved. At least, it works for me.

这篇关于测试支持图书馆Android Studio中源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆