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>
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?
I had the same issue. In my case the application under test (not the test application) did not have the INTERNETpermission.
Related
I have made an app which is pre-installed on android device of particular manufacturer. After this I have release an upgrade of application for example initial version 1.0.0.0 to upgrade version of 1.2.0.0. After upgrading the app if user restarts its phone then my application goes to the initial version of 1.0.0.0.
Don't know why this is happening ? Is there a problem in bundling the application to devices ?
Note: I am updating my app via my server and not from play store and this issue is reproducible only when app is pre-installed on devices.
In mainfest file of both the versions I forgot to change android:versionCode value, in both the versions android:versionCode=3. Is it creating problem because of this?
I have also changed the package name of Application class so is this is creating the problem ?
Manifest for first version:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.apps.spinr"
android:versionCode="1"
android:versionName="1.0.0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/SpinrTheme"
android:name="com.abc.xyz.GDApplication">
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Mainfest for second version:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.apps.spinr"
android:versionCode="1"
android:versionName="1.2.0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/SpinrTheme"
android:name="com.xxx.apps.GDApplication">
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Thanks for the suggestion. As #Mahmoud in comment suggested that "google play never release update for the app with the same version code", so I incremented version code of app and it worked fine. #Rat-a-tat-a-tat Ratatouille as I said in question I am not updating my app via google play neither my app is on play store so I was not able to figure this out initially. Anyways thanks for help.
So conclusion is
whenever you want to send upgrade of app always increase version code
of the app
I have built & sign my apk by Eclipse ADT as it is describes (export and sign by creating a new key). But it can't be install on real device while an errors occurs, such as "installer package error". I have no Android device & sent my apk to friends by email. I'm using AVD and everyth is fine with it. Any suggestions? Thanx guys.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:permission="android.permission.INTERNET"
android:allowBackup="true">
<activity
android:name="com.XXXX.YYYY.ActivityMain"
android:label="#string/main_activity_title"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.XXXX.YYYY.ActivityDetails"
android:parentActivityName="com.XXXX.YYYY.ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application></manifest>
UPD: apk installs good, but the error occurs if choose Open (see screenshot). After that app works fine. But on tablet if try open app it says "App deleted".
UPD2: add supporting API 4+ meta tag for the 2nd activity, but it takes no effect
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.XXXX.YYYY.ActivityMain" />
You probably need to make sure your device and your friend's devices can install apps that are not from the play store.
This is a feature you have to specifically set, or else apps that are outside the play store will not install.
Here is how to set it:
Open settings
Find the Security settings (Pre 4.0 it is under Applications)
Look for a setting that says Unknown sources, or non-market apps
Enable that setting
Everything should work after that!
Here is an article with pictures if you are still confused :)
Your example was missing the closing </manifest> and android:enabled. I'm not sure if the latter would prevent a device from fully installing it but the first one would.
I've also had issues using the full activity names in the past, so you may want to try using simplifying them to see if it helps.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:allowBackup="true">
<activity
android:name=".ActivityMain"
android:label="#string/main_activity_title"
android:enabled="true"
android:permission="android.permission.INTERNET"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ActivityDetails"
android:parentActivityName=".ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application>
</manifest>
Is "Unknown sources" option under "security" allowed on device?
My problem was a duplicate internet permission request on Manifest! When I remove that from activity app was run normally.
I have tried everything to get this to work and now I have this error:
Exception in thread "main" java.lang.NoClassDefFoundError: android/app/Activity
There is another post on here that says to try this in the manifesto:
uses-library android:name="com.google.android.maps"
uses-permission android:name="android.permission.INTERNET"
This solution does not work for me.
As background, I am running one windowsXP, I had to change the Bootstrap Entries to JRE System Library and JUnit3 to fix another error. I also had to change the path for the emulator to run as well.
This is my first time trying to run the droid app stuff on here. I am using the hello world example. I assume I must run the emulator for the phone first then run my code?
Thanks
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.rit.cs.ats"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".AndroidTestActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />
</application>
</manifest>
I've published an app today mainly for my forum users to use, just a
very simple app that displays wallpapers derived from the forum.
Problem I'm having is one guy says it doesn't appear in the market,
and I've even sent him the APK to install manually but it fails.
My minimum SDK version is 4, I created it with the 1.6 SDK specified
so not sure why he can't see it or install it. He has a 1.6 Magic
handset.
So just wondering if anyone has any ideas, the app is called bocn
wallpaper, it uses internet and set-wallpaper permissions.. but I
wouldn't have thought the permissions were the problem...
My manifest is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="net.dbws.bocnwallpaper">
<application android:icon="#drawable/launcher_icon"
android:label="#string/app_name">
<activity android:name=".Main"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:value="xxxxx" android:name="ADMOB_PUBLISHER_ID" />
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
Please, check the supported screens: http://developer.android.com/guide/topics/manifest/supports-screens-element.html
Android 1.6 has small-screens flag set default to false. May be it causes that the application is not seen on the device of the guy.
After I have set up all the unit test cases for my android application I now also want to do functional testing. But I encouter one problem. As I am developping for the HTC Legend I can, by now, only use android platforms up to 2.1. But in some way it seems that the ActivityInstrumentationTestCase2 won't work.
public SupplierSelectoinTest() {
super("com.sap.catalogue.activities", SupplierSelection.class);
}
This simple piece of code gives me the following error, when I try to run the test:
java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.sap.catalogue.activities/com.sap.catalogue.activities.SupplierSelection }
at android.app.Instrumentation.startActivitySync(Instrumentation.java:371)
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87)
at com.sap.catalogue.test.acceptance.SupplierSelectoinTest.setUp(SupplierSelectoinTest.java:27)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
I read through all tutorials and all I get out of it is, that it should work but it doesn't. Anyway, when I switch to android 2.2 (which is no solution for now) and I use the new constructor, where I only need to hand in the activity class and not the pkg string the emulator will run the tests without complaining.
But there has to be a way to get this running in android 2.1!
In addition
These are my two Manifest.xml files. The first one, is the one of the application itself. The other one is the one of the test project.
Application Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sap.catalogue"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".Catalogue"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.CategoryBrowser"></activity>
<activity android:name=".activities.ProductDetails"></activity>
<activity android:name=".activities.ProductSearch"></activity>
<activity android:name=".activities.ProductView"></activity>
<activity android:name=".activities.SupplierSelection"></activity>
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
Test Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sap.catalogue.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="android.test.runner" />
</application>
<uses-sdk android:minSdkVersion="7" />
<instrumentation android:targetPackage="com.sap.catalogue" android:name="android.test.InstrumentationTestRunner" />
</manifest>
Use the top level package name.
public SupplierSelectoinTest() {
super("com.sap.catalogue", SupplierSelection.class);
}
Most probably, you didn't write the activity in the Manifest.xml. Would you share it also?
Edit:
Add this to the test Manifest.xml. I think, this will solve your problem.
<activity android:name="com.sap.catalogue.activities.SupplierSelection"></activity>