I Can install apk of my project but cant see it, why? - android

I download my project.apk to my mobile, I install it, at the end it says (Done) and (Open), the (Open) is unhighlighted, I go to (Done). When I look for it to run it, I cant find it, when I go to settings >> Applications to uninstall it, I find it!
Why? :)

In AndroidManifest.xml check if you have this inside the Activity which is your main activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This is the piece of XML that informs which activity is considered the main activity in your android application. If this information is missing, no launcher will be set, which means no way to start your activity. That's why you don't see an icon of your application, neither can you launch it.

Related

Android Studio: Default Activity Not Found and than USB Debugging not woking

I re-installed my Android Studio. My first problem was, that when I try to run my Activity, I got an error:
Default Activity Not Found
. So I change the configuration, instead of choosing Default Activity in the Launch Option I choose Nothing.
I think this is the problem why nothing is happening after I run the project. It's make sense, cuz nothing is lauch or am I wrong?
The Android Studio see my device and it's connecting via USB. I done this before, so I know that I have to allow USB Debugging on my device and i did. After I hit run, start to loading, and than it's says that:
Install succesfully finished in 212 ms. App restart succedful without
requiring a re-install.
But nothing is happening neither in my computer or my phone.
In order to start your App, it needs an "entry point". You can define it in the AndroidManifest.xml file like:
<activity android:name="com.myapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In the first line you add the package path + your Activity you want to open at startup. The reason why you got the error msg Default Activity not found probably is, that you created a project without an Activity.
To create a new Activity simply right-click to the package in Android Studio -> select New -> Activity -> and then e.g. Empty Activity
Just add a filter tag in the Manifest.xml file to the activity that you want the to starts with
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

installed application from Android Studio opens another activity instead of launcher activity

Whenever I run my app from Android studio, an Activity having
android:exported="true"
get's launched instead of launcher activity
<activity
android:name=".activity.SplashScreen"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
But once app installed, correct launcher activity opens, no issue.
Only issue happens when I launch my app from Android studio(i.e. by running the app). So why this happens?
Without android:exported="true", on some devices, that activity not gets launched after clicking notification of my app. So is it good to keep exported true?
Also I can't post my entire manifest here
When running the app from Android Studio, you're probably using instant run. which applies the code changes to the current running process of your app, so instead of installing the app again, it applies the new changes to the running app, in that case you see the current running activity as it is.
http://android-developers.blogspot.com.eg/2016/04/android-studio-2-0.html
https://developer.android.com/studio/run/index.html
If it only happens in Android Studio and not when the app is installed, it is most likely a problem with the run configuration. You can access it by going to
Run -> Edit Configurations

Cant upload my app with Android Studio

I tried to upload a testing app (just blank page) to my phone.
I can see my phone in the list when I press run and there is no new app in my phone and nothing apears there.
why?
thank you.
Firstly, if you app is failing to compile, you will need to check Android Studio for compilation errors. These can be found in the Messages view.
To put your app on a device, your test device will need USB Debugging enabled on it. Please see this answer for more information on how to turn it on should you have missed this step.
If the app is compiling but isn't starting, ensure that you have the following intent-filter within your main activity's definition in your AndroidManifest.xml file.
<activity
android:name=".YourMainActivityName"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This intent filter is how the Android OS works out which activity to launch when the app is freshly opened. Without this filter, no activity will start.

Interact with Android Setup Wizard

I am trying to develop a setup wizard for Android, as I would like to add some functionality to the one existing from Google. Is it possible to somehow interact with the Android wizard? Because when I have searched for information I've seen that not using Google's Wizard might cause some trouble, regarding gmail account activation and so on.
If not, could an activity be called immediately before or after Google's wizard? Would it be enough to just listen to the BOOT_COMPLETED event?
Thank you very much in advance!
I don't know how you will use this unless you are making a rom and can add your app to system but basically you make your setupwizard add-on a Home activity with action MAIN, and categories HOME,DEFAULT. You should also set the priority higher than 1. If any of this is unclear you can look at the Launcher source/manifest that is publicly available.
When your activity is done it should deactivate itself with the PackageManager (setComponentEnabledSetting) and that should be it.
You can add additional activities that start the first time the phone is boot up. You just have to mimic the same behavior as Google's SetupWizardActivity.
Here's the relevant portion in the AndroidManifest.xml for reference:
<activity android:theme="#style/InvisibleNoTitle" android:label="#string/setup_wizard_title" android:name="SetupWizardActivity" android:excludeFromRecents="true" android:launchMode="singleTop" android:immersive="true">
<intent-filter android:priority="5">
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This will allow you to run your application before/after SetupWizardActivity, depending on your priority. I believe higher numbers for android:prioirity run first, but don't quote me on that.
You can find out the AndroidManifest xml for various Android-related apks using apktool. You can even inspect some of apks you picked up from the Play Store or whatever other sources.

Eclipse Android launcher shows home screen, not my application

When I launch my android application from eclipse, it shows the home screen, and I then need to unlock the screen and go to my app. I would like it to just show my app by default.
I have tried right clicking on the app and selecting Run As..., but Android Application is not a choice there. I need to manually create a new Android run configuration for my application and then I launch that.
Is there a way to just make my app show by default? I'm running with the emulator for Android version 2.2?
Note: I'm also getting an error that says "Emulator] Unknown savevm section type 95" which I'm not sure what that means yet
thanks,
Jeff
The emulator always starts with the screen locked. Unlock it and wait a moment, sometimes it needs a minute to launch your app. If it doesn't work after a few moments, leave the emulator open and try running it again. If it doesn't launch now, there's something wrong.
I'm thinking you either didn't create your project as an android project to begin with, or if you did you didn't create a starting activity (or deleted the one that you did create)? Either way, you probably need to go edit your AndroidManifest.xml file and add an intent filter to an activity. Just guessing. Should look similar to this:
<activity
android:name={String for the name of your app}
android:label={String for the name displayed on the icon}>
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
** posted before your edit ^^^
In terms of your error, I have no clue what that is, so maybe it has nothing to do with your AndroidManifest, then. :T
Check your manifest, and make sure your activity has the correct intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
BTW, Previous to Android 1.6 i think the emulator always started with the screen locked then they changed that and it starts with your app

Categories

Resources