草庐IT

test-network

全部标签

android - V2 map 库是否需要 ACCESS_NETWORK_STATE 权限?

我在已发布的应用中使用AndroidV2Googlemap库(GooglePlay服务)。我一直在GooglePlay中看到零星的异常,这似乎表明支持mapfragment偶尔会尝试检查网络状态。但是,库文档没有提到需要此权限。我不直接在我的应用程序中检查网络状态,所以我没有声明这个权限。因此,在扩充支持mapfragment时有时会抛出SecurityException:java.lang.RuntimeException:UnabletostartactivityComponentInfo{com.foo/com.foo.ui.TransactionDetailActivity}:

android - "No tests found"用于 Lollipop 及更高版本的仪器测试

我基于仪器的(espresso)测试无法在Lollipop+设备和模拟器上运行。它们可以在任何其他平台上正确运行。我和这个线程中的人有相同的症状-https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk我的测试在src/androidTest/java/我已经设置了testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner'测试类是@RunWith(AndroidJUnit4.class)个别测试用@Test注解我可以

android - java.lang.SecurityException : Permission Denial: getIntentSender() when using UiAutomation in a test 错误

每当我尝试使用UiAutomation在通过getInstrumentation().getUiAutomation()进行的任何测试中,进程崩溃并出现以下异常:java.lang.SecurityException:PermissionDenial:getIntentSender()frompid=30334,uid=2000,(needuid=1000)isnotallowedtosendaspackageandroidatandroid.os.Parcel.readException(Parcel.java:1540)atandroid.os.Parcel.readExcepti

安卓 : Check 3G or Wifi network is ON or Available or not on android Device

如何以编程方式检查android设备上的网络是否可用,当我们尝试连接Wifi和3G等网络时会抛出一条消息或toast消息。 最佳答案 要检查网络(即3G或WiFi)是否可用,我们可以在开始我们的Activity之前使用以下方法进行验证。ConnectivityManagermanager=(ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);//For3Gcheckbooleanis3g=manager.getNetworkInfo(ConnectivityManag

android - 测试运行失败 : Test run failed to complete. 预期 1 次测试,收到 0

我尝试为我的应用启动JUnit测试(robotium):publicclassMainTestextendsActivityInstrumentationTestCase2{privateSolosolo;publicMainTest(){super("nix.android.contact",MainActivity.class);//TODOAuto-generatedconstructorstub}protectedvoidsetUp()throwsException{super.setUp();solo=newSolo(getInstrumentation(),getActiv

android - isProviderEnabled(LocationManager.NETWORK_PROVIDER) 返回 false

我正在使用NETWORK_PROVIDER获取地点的latitude和longitude。我已经检查了“位置和安全”中的设置并启用了“使用无线网络”。但是"isProviderEnabled(LocationManager.NETWORK_PROVIDER)"总是返回false。谁能帮帮我?提前致谢!这是我的代码:LocationManagerlocManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);booleanisEnableGPS=locManager.isProviderEnabled(Loca

android - 找不到错误 :resource style/TextAppearance. Compat.Notification.Info(又名 {packageId}.test :style/TextAppearance. Compat.Notification.Info)

我刚刚将build.gradle编译SDK更新为27API。compileSdkVersion27buildToolsVersion'27.0.3'targetSdkVersion27但是一旦我点击同步按钮它就​​会抛出error:resourcestyle/TextAppearance.Compat.Notification.Info(aka{packageId}.test:style/TextAppearance.Compat.Notification.Info)notfound.error:resourcestyle/TextAppearance.Compat.Notificat

android - 真的更喜欢网络 : select my own network provider as soon as it is available (from code)

我住在边境附近,在另一个国家工作。所以我选择了自己的网络提供商作为最爱。但是,我注意到它会尽可能长时间地与提供者保持联系。因此,当我从我的国家开始时,即使我跨越国界,我也会保留我的网络,但是,当我从另一个方向出发时,即使我最喜欢的网络已经可用,它也会保留国外网络。我知道这一点,因为当我想手动选择它时,它可以从列表中获得。现在,我想创建一个应用程序,它会在漫游时自动搜索我的首选网络,每次它连接到另一个手机信号塔。现在我明白了,以前我可以用广播接收器改变小区位置,但现在不可能了。(这是一个遗憾)我从中读到:ProgramaticallyconnectingtoanotherNetworko

android - 在 Android Studio 项目上找不到参数的方法 test()

在我的Android应用程序中,我想在包中排除一些测试用例,以便我在build.gradle文件中使用test任务。例如:applyplugin:'com.android.library'test{exclude'**/calltest/Summary.class'}如果同步项目我得到以下异常:*Whatwentwrong:Aproblemoccurredevaluatingproject':SdkModule'.>Couldnotfindmethodtest()forarguments[build_4g3vf7b615x3x1p7i9ty0pt1l$_run_closure1@73d

android - 多模块 Android 项目中的全局代码覆盖率 : merge code coverage reports (Unit & UI tests)

我有一个由2个模块组成的Android应用:应用-用户界面子模块-具有大部分业务逻辑对于它们中的每一个,我都有一个gradle任务来验证代码覆盖率:应用:UI代码覆盖率(Espresso)子模块:单元测试代码覆盖率作为客户的要求,我需要合并这两个报告以获得应用程序的整体/全局代码覆盖率。注意:我使用的是Gradle版本3.1.2。应用程序Gradle文件:applyplugin:'jacoco'android{testBuildType"uiTest"...buildTypes{debug{applicationIdSuffix".debug"versionNameSuffix"-de