I am unit testing an android applications using Robitium. When I install the test project in to android emulator, I can't find the icon of the test project, but I can run it.
The manifest file of the test project is like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smartek.screens.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.smartek.screens" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
What should I do to make the test project icon visible?
The test project will not contain the launcher entry in manifest file, so you cannot see the icon on launcher.
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
We can do this and its same as the normal android application .
Add the following lines to the android manifest file
<activity android:name=".Testing class name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Related
I made a new project in Android studio, and this is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cro.perger.rajcica" >
<application
android:allowBackup="false"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".rajcica" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
When I build my file I get few gradle errors, and I get this debug/manifest file open:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cro.perger.rajcica"
android:versionCode="10"
android:versionName="2.0.1" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name="cro.perger.rajcica.rajcica" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I get this errors:
URI not registered
element not allowed for (versionCode, versionName, icon, allowBackup, theme, supportsRtl)
Don't know how to resolve this, because many of this attributes are deleted from my manifest file, but not from debug/manifest file :(
Please help
If you removed those lines from the manifest, but they are still in your debug, then it sounds like your manifest is in the wrong folder. Something changed in your directory structure maybe and you did not realize or intend for that to happen.
Get the manifest in the right folder and make sure that you are editing the correct one.
See this related post: Why is Android Studio reporting "URI is not registered"?
It also could be that you are setting them in your build.gradle file - check there.
I downloaded google's sample in app purchase app and renamed the package to "com.iap.android.trivialdrivesample" wherever it appeared in AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iap.android.trivialdrivesample"
android:versionCode="3"
android:versionName="1.3" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. -->
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.iap.android.trivialdrivesample.MainActivity"
android:label="#string/title_activity_main"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Uploading the apk into google play shows the error "cannot use package name com.example". I expanded all my folders in android studio and don't see any packages starting with "com.example". How can I list them from the command line to make sure?
I'm making an android widget, but I got this warning from console when running my application on emulator
No Launcher activity found!
The launch will only sync the application package on the device!
Here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.analogclock.android"
android:versionCode="1"
android:versionName="1.0"
>
<uses-sdk android:minSdkVersion="3" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<receiver
android:name=".AnalogClockWidget"
android:label="#string/app_name" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="#xml/appwidget" />
</application>
</manifest>
What's the reason? Please give me a solution
This is normal as your widget does indeed not have any activity!
I am guessing you are using the Run or Debug button on Eclipse.
In this case the Run button cannot add your widget to the home screen for you, so it only install the package and give you this warning.
Check that your widget appears in the chooser, when you try to add a widget on the home screen. If it does, then it is working as expected :)
EDIT: try with this manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.analogclock.android"
android:versionCode="1"
android:versionName="1.0"
>
<uses-sdk android:minSdkVersion="3" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<receiver
android:name=".AnalogClockWidget"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="#xml/appwidget" />
</receiver>
</application>
</manifest>
My manifest FILE IS:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Smsr"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:label="#string/app_name"
android:targetPackage="com.example.Smsr" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".SmsrActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".SimpleSmsReciever" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
</manifest>
Error is :smsr does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner in its AndroidManifest.xml
i have two classes here , first is main activity i.e smsrActivity and other is simplesmsreciever class , help me
thanx in advance
I think may be ur problem is you have to set minsdk version and target version. Then it will work
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="20" />
You are missing <uses-library android:name="android.test.runner" /> in application tag.
for more causes and detailed knowledge check out a previous question
Android Eclipse Plugin: Instrumentation Test Runner not specified
try to run your application as android application. right click your application folder and go down to run as --> android application.
I don't know how or why but this worked with me :)
I have two manifests that I swap round when building different releases of my app. The manifests have different package names yet I can only build one on the device at a time. I really need both to be built. The project has no src files and uses an activity from a library.
Manifest one:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.pkgone" android:versionCode="01" android:versionName="0.1">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<activity android:label="#string/app_name" android:name="com.test.Splashscreen" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Manifest Two:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.pkgtwo" android:versionCode="01" android:versionName="0.1">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<activity android:label="#string/app_name" android:name="com.test.Splashscreen" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I've sorted it out! The issue was that the R.java file in the gen folder wasn't being cleaned so I just ran
ant clean
before
ant release
and it works great! Thanks to #enrmarc and #Roman Nurik for their help :)
I solved it. I had the same problem.
You need to change the "applicationId" in your build.gradle(Module:app) file
be aware that there will be two build.gradle files. Open the one with (Module:app)
then clean your project.