My android tests don't get internet access!

The subject says it all. My application gets internet access thanks to the android.permission.INTERNET permission, but my test cases don't while using the instrumentation test runner.

This means I can't test my server IO routines in my test cases. What's up?

Here's my manifest in case it helps you. Thanks!

Sorry about the lack of indents - could not get it working on short notice with this site. Thanks!

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

<application android:icon="@drawable/icon" android:label="@string/app_name">

<uses-library android:name="android.test.runner" />

<activity android:name=".HelloAndroid" android:label="@string/app_name">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

</application>

<uses-sdk android:minSdkVersion="2" />
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="qnext.mobile.redirect" android:label="Qnext Redirect Tests" />

</manifest> 


Asked by: Aldus376 | Posted: 24-01-2022






Answer 1

I've compared your manifest file with mine, and it looks about the same. Only difference is that I require minSdkVersion 3, and that I have the uses-permission after the application tag. I don't think that should make a difference.

Are you trying to run on the emulator or on a phone?

Answered by: Miranda633 | Posted: 25-02-2022



Answer 2

I had the same issue. In my case the application under test (not the test application) did not have the INTERNETpermission.

Answered by: Rafael793 | Posted: 25-02-2022



Similar questions

Is it possible to use MMS to stream Internet radio in Android?

Is possible to play an Internet radio stream in Android? And since most of the Internet radios use MMS to stream their content is that possible using Android?


Is it possible to use MMS to stream Internet radio in Android?

Is possible to play an Internet radio stream in Android? And since most of the Internet radios use MMS to stream their content is that possible using Android?


Perform single SQL query over internet Android

I am trying to find a way to goto a database located on the web perform 1 query and close the connection. I have not had any luck with finding an answer, and I really don't know how to solve this. Internet connection is not an issue, nor is any security issues. Also this cannot be solved with an internal database and this must go across the web. If you have any hints or ideas please let me know! Th...


unable to connect with internet in android emulator behind proxy in windows

I am very new to android. I tried to connect to internet behind proxy in windows.But I cant. I tried with the "-http-proxy" in command line and in eclipse but both did not worked for me :( Please suggest me a right way to enable proxy in emulator Thanks in advance


Button contains text & image from the Internet [android]

how could i get an image and a text from the Internet and made a button for my android application dynamically?And draw them in th position i want. i.e by Java code thinks


Cannot access the internet while i debug android on device

I'm trying to develop an android application that uses network connection. The server is up and running, but when i am trying to access it from the device that runs the android app (in debug mode-using eclipse) it outputs a message that 'cannot find the server' after a UnknownHostException occurs! I have tested the server with a java application and it works fine! What is the problem then with the device?


Android : collect Quick Search Box result form internet

I'm doing a app which allow user to search on the server. how can i get the text from the Quick Search Box and send to server? if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String search= intent.getStringExtra(SearchManager.QUERY); } the string "search" is it the text which typing by user? P/S: sorry about my bad english. Hope you guys understand what's I'm talking ...


java - how to creat a rss feed from an internet website with android?

i wanted to do an application which use a rss feed from the web, and i wanna know if someone have a tutorial somewhere or could just explain to me how to do it. (I started coding in android like two months ago)


android - bitmap size exceeds VM budget while loading image from internet?

i am trying to display image from internet in my imageview. which is raising following error any one guide me what mistake am i doing here public Bitmap DisplayLiveImage(String ImageSrc) { Bitmap bm; try { URL aURL = new URL(ImageSrc); URLConnection conn = aURL.openConnection(); ...


How to display an image from the internet in android?

How can I display image in an ImageView in android from a URL (from the internet)?


Android turn on GPS and Internet

How to turn on GPS and Internet on Android, with code?






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top