MyFirstApp installed on emulator but can't launch it - android

I'm going through the Android 'Building Your First App' tutorial and have gotten stuck trying to run the app. I created the app and emulator with Eclipse (Juno Build id: 20120920-0800 on OS X, default installation. The Android SDK, etc. was updated today).
The app appears to be installed on the emulator. I.e. 'Home -> Menu -> Manage Apps' lists it and it's App info looks ok. (Total=24.00KB, App=24.00KB, USN storage app=0.00B, ...).
However, it does not appear in the apps launch list (i.e. the screen with 'API Demos', 'Browser', etc.
Is there some other way to launch it? Is there something I have to do to get it into the app list? Any help would be appreciated - this is driving me crazy.
thanks

In your manifest xml file you need to make sure that you have
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.
Your manifest file should have something like (this isn't a complete manifest)
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MyActivity"
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>
You can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.
Don't forget to save your manifest file and do a clean and build then run it.

Related

How to choose an activity as a starter activity while launching an app?

I come up with a strange problem while trying to set "SignUpActivity" as my starter activity. I tried different ways but either I am getting an error or "mainActivity" is popping up as a starter activity.
My "AndroidManifest.xml" file has the following code.
<activity
android:name=".SignUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
the above code gives me the error as shown in image
As the error states activity must be exported or contain an intent-filter
so, I did
<activity
android:name=".MainActivity"
android:exported="true"/>
and also tried adding intent-filter to activity. Of course, these methods make error go away but my app starts with MainActivity, not with SignUpActivity. What should I do to slove this issue?
Your AndroidManifest.xml is set correctly, check your run/debug configuration is set to 'App', not 'MainActvity'
If the 'App' configuration is missing - you will need to add it by first selecting 'Edit Confurations'
There are similar posts about this error msg.
Check the run configuration , probably you need to edit the app configuration and choose it to run.
As guided by #Eric I selected an option "app" from the run configuration which solved my problem. Previously, somehow it was set to MainActivity which was causing the issue. I have attached an image to demonstrate the solution for future readers.

Android - Custom Home Application Doesn't Appear When Click Home Button

I'am using Android Studio and I have developed an Home Application by adding
<activity
android:windowSoftInputMode="stateAlwaysHidden"
android:screenOrientation="landscape"
android:launchMode="singleInstance"
android:stateNotNeeded="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
</intent-filter>
</activity>
This is working and I am testing my application with run button no problem.
But after run another app from Android Studio the home application stop appearing home button selection screen.(not everytime). This is how I solve my problem
I create another application
Move files and codes to new created project.
Then my code is working with different name
This looks like a bug, I dont know what is that. Is there a way to clear cache data or another simple way to solve the problem or any suggestion?
You most likely have a different launcher set as default launcher.
In the settings of your device you should be able to set the default launcher.
Go to applications and look for your current launcher. Clear the default launcher.
If you cleared the default launcher and correctly installed your launcher, it should now ask every time which launcher to launch when you hit the home button.
Tip: Try it out on different devices and emulators!

Application icon does not appear after installing android app

I am developing an android app and when I install the app on android phone, the application icon does not appears in application section. But it appears in application manager and I can make uninstallation. After googling, some said I need to rebuild my project and to make sure the app icon in drawable resource. I already tried for this solution and the problem is still occurring. The manifest file I created is as follow:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MyActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.view" />
<data android:scheme="geo" />
</intent-filter>
</activity>
</application>
I believe geo scheme cannot be used with Launcher. I can't find any documentation but in this tutorial they suggest to use with default category.
Please try to move your location related code to another activity and move scheme=geo filter to that one.
In your manifest in activity try using or add another intent filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
`
Change
android:icon="#drawable/ic_launcher"
With your icon
if you wanna to remove this icon you have to remove from all folder like
drawable
drawable-hdpi
drawable-mdpi
drawable-xhdpi
I set action android:name="android.intent.action.MAIN and android:name="android.intent.category.LAUNCHER two of mine activity intent.For this I'm having two launcher icon.When I noticed that I remove one activity's intent filter,but My launcher icon disappear.I tried all the mentioned above solution but didn't work.As I noticed Darpan's comment about re-starting your phone will fix it I tried and It works for me
In my case, my manifest included a label for the main activity. I deleted the label, restarted the app and the icon magically appeared in the applications list.

android app running multiple instances

When i download my app from store.
its installed on main screen, and on apps menu ( when i click the circle with 6 dots on it )
when i click from main screen it opens an app, and when i click from the other place..it opens a second app as well.
i need one app running only..
how can this be fixed?
my manifest
<application
android:name="dfsfsdp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".StartupActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I think you aren't running multiples instances (if you are running multiple instances if fail of the mobile), or you see two applications open in the menu what you use to close the running apps (the recent applications menu)?
If you only see one maybe your are restarting the same instance. Look at your StartupActivity or post here to try help you.
If this don't help you, take a look at to read about the lifecycle of an Activity:
http://developer.android.com/training/basics/activity-lifecycle/index.html
Best regards.

Where can I find documentation when coding in Eclipse?

Then writing XML as manifest, how can I find documentation for things like intent-filter or action? Can I somehow display information on this in Eclipse without visiting developer.android.com like I can see the JavaDoc in Eclipse?
<activity android:name=".Activity1"
android:label="Activity1">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In Eclipse just press Ctrl+Space and you will get descriptions of elements.
Just make sure you're opening your manifest with the Manifest editor (right click on manifest -> open with -> Android Manifest Editor). Anyway why not use the GUI editor? You have tips there as well.
A good start: http://developer.android.com/guide/topics/manifest/manifest-intro.html

Categories

Resources