hello I want to change default activity. But when I do that the app doesn't launch at all without any errors
<activity
android:name="com.example.dimmer.MainActivity"
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="com.example.dimmer.DevicesActivity" >
</activity>
This way MainActivty launches with no proble. It also goes to Device activity when I press the button. So everything works fine.
Now I need DevcieACtivty to be default one.
I change Manifest like that
<activity
android:name="com.example.dimmer.DevicesActivity"
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="com.example.dimmer.MainActivity" >
</activity>
but now app doesn't launch. no errors. nothing is written in console.
it's just doesn't do anything,
what might be a problem?
It starts to write the following error
ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.dimmer/.MainActivity }
[2014-05-16 21:17:10 - Dimmer] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.dimmer/.MainActivity } from null (pid=13093, uid=2000) requires null
full Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dimmer"
android:versionCode="1"
android:versionName="1.0"
android:hardwareAccelerated="false">
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.dimmer.DevicesActivity"
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="com.example.dimmer.MainActivity" >
</activity>
</application>
</manifest>
[2014-05-16 22:13:25 - Dimmer] Android Launch!
[2014-05-16 22:13:25 - Dimmer] adb is running normally.
[2014-05-16 22:13:25 - Dimmer] Performing com.example.dimmer.MainActivity activity launch
[2014-05-16 22:13:26 - Dimmer] Uploading Dimmer.apk onto device 'SH17VT514235'
[2014-05-16 22:13:26 - Dimmer] Installing Dimmer.apk...
[2014-05-16 22:13:29 - Dimmer] Success!
[2014-05-16 22:13:29 - Dimmer] Starting activity com.example.dimmer.MainActivity on device SH17VT514235
[2014-05-16 22:13:29 - Dimmer] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.dimmer/.MainActivity }
[2014-05-16 22:13:29 - Dimmer] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.dimmer/.MainActivity } from null (pid=15458, uid=2000) requires null
Since you've defined your package as "com.example.dimmer", you can remove package name and use just the name of Activity with dot in front:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".DevicesActivity"
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=".MainActivity" >
</activity>
</application>
Moreover, check your Run configuration settings in Eclipse. If your launching activity was set to MainActivity, and in manifest you make DevicesActivity as main, your app might not start when launching via Eclipse. Click arrow for RUN icon and choose "Run Configurations",
Then make sure you choose DevicesActivity as Launch:
Uninstall the app on your phone, and redownload it.
Make sure you implement setContentView in onCreate method.
In other way try clean the project Project > Clean and run it.
I am not sure but Now you can some step a head.
such as
1. delete Android.R (in above in your activity )
2. or replace package.R for example , com.example.name.R
3. check you res folder or sub-folder resources .
such as layout attribute right or not.
4. Delete gen and bin folder.
5. clean your project thus: project=>clean
6. restart your eclipse.
Remember that if your resource not found then show this type error.
Best of luck!
Click arrow for RUN icon and choose "Run Configurations"
Android Application =>select project
open Target tab
select Always prompt to divice
click run and select Divice online
Related
I created a splash screen for my android application. In my AndroidManifest I set the SplashScreen Activity as Launcher and action as MAIN. After that I changed the HomeActivity's intentfilter.
Here is my android manifest file:
<application
android:allowBackup="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SplashScreenActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActivityHome"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.ACTIVITHOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name=".Receivers.NetworkReceiver"></receiver>
</application>
I have both these activities inside the default package. Now, when I try to test the application in device, I get the following error:
Error while executing: am start -n "com.sdz.myapp/com.sdz.myapp.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.sdz.myapp/.SplashScreenActivity }
Error type 3
Error: Activity class {com.sdz.myapp/com.sdz.myapp.SplashScreenActivity} does not exist.
Error while Launching activity
This is how my project structure looks like:
src
-com.sdz.myapp
----ActivityHome
----SplashScreenActivity
I restarted android studio but still the error is there. I dont know what is causing this.
I ran into this as well. I actually had to uninstall the apk from the device before it would work... which was really odd as the app wasn't showing up on my list of apps on the phone.
Here's what I did:
Opened up command line
Ran 'adb devices' to make sure my device was connected
ran 'adb uninstall ' Replace with "com.whatever.blah"
You should see a message saying it uninstall successfully
Try installing from Android Studio again and it should work
I have no idea how it gets in this weird state. :-/
Please change your android:name value at your activity tag with full name and first clean project . After that try to run your application again
<activity android:name="com.sdz.myapp.SplashScreenActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have this same issue occasionally. The solution was to build the APK (menu "Build > Build APK") and install it manually in the phone. After that the error disappears.
I tried all of the above plus even delete the build folder and still did not work. The solution for me was: On your Android Studio go to File->Sync Project with Gradle Files
I'm new just working with some basic Android codes. My problem is that Android Emulator is not showing any output when I run code. It takes really long and on console it sticks here
[2013-03-31 03:17:55 - Helloworld] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloworld/.MainActivity }
and emulator looks like this
I have waited for 5-10 minutes but it does not show output. Please guide me where the problem might be. I downloaded sdk ADT Bundle for Windows and configured it as mentioned in official site.
In Eclipse, try :
Window -> Show View -> Other -> Android/Devices
Select the Emulator from the newly added Devices window, and check back your logcat.
I'd try a little debug, and set a break point on the very first line of code in your app's main activity. Then I'd step thru and see where it breaks.
I've just encountered the similar problem, in my case I forgot to add the activity in AndroidManifest.xml file.
The following is my Manifest file for example ...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testalarm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.testalarm.MainActivity"
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="com.example.testalarm.CheckpointActivity" >
<intent-filter>
<action android:name="com.example.testalarm.CheckpointActivity" />
</intent-filter>
</activity>
</application>
</manifest>
Check if you have all required activities as <activity> under <application>
In my emulator app installed successfully but app is not launching ,here i am pasting the console details
here i am adding manifest file as well ,i added intent-filter as well.
i hope this info is enough but stackoverflow needs some more info .
[2012-12-13 20:29:52 - PongUr2] Android Launch!
[2012-12-13 20:29:52 - PongUr2] adb is running normally.
[2012-12-13 20:29:52 - PongUr2] No Launcher activity found!
[2012-12-13 20:29:52 - PongUr2] The launch will only sync the application package on the device!
[2012-12-13 20:29:52 - PongUr2] Performing sync
[2012-12-13 20:29:52 - PongUr2] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'AVD_4.0'
[2012-12-13 20:29:52 - PongUr2] Uploading PongUr2.apk onto device 'emulator-5554'
[2012-12-13 20:29:53 - PongUr2] Installing PongUr2.apk...
[2012-12-13 20:30:00 - PongUr2] Success!
[2012-12-13 20:30:01 - PongUr2] \PongUr2\bin\PongUr2.apk installed on device
[2012-12-13 20:30:01 - PongUr2] Done!
HereÅ› the xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sabrebutt.pongur"
android:versionCode="49"
android:versionName="0.8.8.2" >
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<service
android:name="PongUr"
android:enabled="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter android:priority="1" >
<action android:name="android.service.wallpaper.WallpaperService" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/pongur" />
</service>
<activity
android:name="PongUrSettings"
android:exported="true"
android:label="#string/pongur_settings"
android:theme="#android:style/Theme.Black" >
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
/>
</manifest>
None of your activities have launcher intent filter, Add below lines to the activity you want to launch in your manifest
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Edit:
You cannot have an intentfilter inside an intentFilter and the launcher intent filter will not work on service, only Activities can be launched and can have UI
<activity
android:name="PongUrSettings"
android:exported="true"
android:label="#string/pongur_settings"
android:theme="#android:style/Theme.Black" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Try going Setting -> Application(apps) --> uninstall your app & run again your app . May be it should work.Sometimes previous installation creates this type problem.Otherwise may be problem with your menifest file.
Not specific to this particular error. When app is installed and not launched, you can check the 'Launch options' in 'Run Configuration'. It should be selected as 'Default Activity'.
I have a problem...
I'm making a simple program about GIS, and when I'm trying to launch it from eclipse to my device, I get warning when I check the console.
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.warteg.GIS/.Splash } from null (pid=16196, uid=2000) requires null
and the program is not installed in my device, but when I try with emulator from eclipse, the program is launched.
Can someone solve my problem? Here's my manifest XML.
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="Splash"
android:label="#string/app_name">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps"></uses-library>
<activity android:name=".Splash"></activity>
<activity android:name=".FormPetunjuk"></activity>
<activity android:name=".Peta"></activity>
</application>
your are registering Splash activity two times in manifest.xml so remove this one:
<activity android:name=".Splash"></activity>
I'm trying to luanch my application, and this is the log:
[2012-03-07 19:45:12 - hhs] Android Launch!
[2012-03-07 19:45:12 - hhs] adb is running normally.
[2012-03-07 19:45:12 - hhs] Performing hhs.pack.HhsActivity activity launch
[2012-03-07 19:45:15 - hhs] Application already deployed. No need to reinstall.
[2012-03-07 19:45:15 - hhs] Starting activity hhs.pack.HhsActivity on device emulator-5554
[2012-03-07 19:45:16 - hhs] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=hhs.pack/.HhsActivity }
[2012-03-07 19:45:16 - hhs] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=hhs.pack/.HhsActivity } from null (pid=-1, uid=-1) requires null
I've been searching for some answers and understood that the problem is from my manifest file. The problem is that I didn't touch my manifest for a long time (and it works today with the same manifest.
Anyway, as I assume the manifest is important, this is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hhs.pack"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".HhsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black" >
</activity>
<activity android:name="SimpleServiceActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".Service.SimpleService"></service>
</application>
</manifest>
The weird thing is:
[2012-03-07 19:45:15 - hhs] Application already deployed. No need to reinstall.
That sound like your app ist deployed. Try to manually deploy it or increase the versionCode.
Try
adb install -r
so he will deploy even if the versionCode is equal or higher to your current versionCode
EDIT
Try to replace this line
<activity android:name="SimpleServiceActivity" android:label="#string/app_name">
with this one:
<activity android:name=".SimpleServiceActivity" android:label="#string/app_name">
Or where ever the package with the activity is located. The important thing here is the [.] before your Activity. Without that it is unknown that your Activity is in the root package.
Make sure you have your app listed in the application nodes. I've had many a times tried to figure out why an app wouldn't run when it was as simple as that.
Also check that you have an intent filter on the activity for android.intent.action.SEARCH
and make sure you have the meta filters:
<meta-data android:resource="#xml/searchable"
android:name="android.app.searchable"></meta-data>
<meta-data android:name="android.app.default_searchable"
android:value=".MyActivity" />