I am new to Android Studio and I am trying to deploy an APK to my mobile device in order to test the app. I build the APK successfully but when I install the apk of the app in my device I couldn't see it or cannot be open. But I can see the apps in the app manager showing that I installed it.
here is the code in my manifest file.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Pasig NutriCare"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.DEFAULT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Looking for help.
Thanks in advance.
Did you checked Sort / Alphabetical / Custom ?
Also Check AndroidManifest.xml
Main Activity Should Contains :
Like :
<activity android:name=".SplashActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
So change .SplashActivity to that you want And Remember to place dot . before it as i did
if you use sub Package Name place it , For Example :
your package is : com.example.myapplication
you create sub package as : activities
so in AndroidManifest.xml you have :
<activity android:name=".activities.SplashActivity"
...
</activity>
Make sure you specify the launcher activity for the app in your AndroidManifest.xml file:
<activity android:name=".YOURACTIVITY" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Did you specify the launcher activity for the app (in the AndroidManifest.xml)? If all else fails, you can also install the app manually using ADB (android debug bridge)
To install manually, Run this command from terminal/command prompt
adb install path_to_apk
Related
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.Wallpaper.NoTitleBar.Fullscreen">
<activity android:name=".MainActivity"
android:launchMode="singleTask"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".AppListActivity"/>
</application>
here android.category.default is used to make this application as default launcher like google launcher but when running this application its throwing error default activity not found...i have tried restarting and invalidating cache several times. can anyone help me...?
you can use this,
<activity android:name=".MainActivity"
android:launchMode="singleInstance"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
Go to Edit Configurations. Within the General tab, in the launch options drop down, select nothing. Now run the app.
You can use Control + Shift + A on Windows or Command + Shift + A on Mac, and type edit configurations to open it.
Just specify activity to lunch in android studio. To do that click on run configuration -> Edit configurations.
In Launch Options pick Specified Activity and then select your activity.
In my Android manifest file "android:name" in both the activities which I have mentioned below shows error when I tried to run the program. How can I fix this?
<activity
android:name=".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=".ContentView"
android:label="#string/title_activity_content_view" >
<activity>
CLean Project
if it doesnt work,
remove tags and add activity again to manifest
I create an Android application with three activities.
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="stateHidden"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="stateHidden"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EmpSelectionActivity"
android:label="#string/title_activity_emp_selection"
android:windowSoftInputMode="stateHidden"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
This is working fine on my Android device (Nexus 5) while I debug the application and run it from Studio directly. But when I generate a signed apk from the studio, the apk is not fetching the preexisting activity while launching from home.
That means: When I Launch the application I select the main Activity from Launcher activity (A login mechanism Over there). Then I press device home icon and click the app icon from device home. Then it's restarting again from the launcher activity instead of the previous MainActivity. But it is not happening while I install the APK without signed one.
Please help me, if anyone have the similar problem and anyone who found the solution.
I have finished my application in Android Studio but when I copy and paste app-debug.apk on my android phone it can't be opened after installation. Can anybody tell me what is wrong a what I need to do to make that app run. Btw when I was writting the code I was running it on my phone through USB cable without using AVD. Here is my AndrodiManifest:
<application
android:debuggable="true"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".SplashActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.category.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.category.MAINACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".InfoActivity"
android:label="#string/app_name">
</activity>
</application>
The problem is likely that your <intent-filter> elements are not correct.
Assuming SplashActivity is the first Activity the user should see when launching your app, your <intent-filter> should have an <action android:name="android.intent.action.MAIN"/> element. Note that your <action> element has the name android.intent.category.MAIN, which doesn't exist.
Your MainActivity's <intent-filter> also looks odd- android.intent.category.MAINACTIVITY doesn't exist, and you probably don't need to set the <category> (or an <intent-filter>) at all. See the documentation for CATEGORY_DEFAULT and determine whether you actually need it.
I have the follow manifest part about application
<application
android:allowBackup="true"
android:icon="#drawable/icon_goodrider_logo"
android:label="#string/app_name"
android:theme="#style/PingTheme" >
<activity
android:name=".passenger.ui.LicenseActivity"
android:label="#string/app_passenger_label"
android:icon="#drawable/icon_logo"
android:taskAffinity="com.city.passenger"
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=".driver.ui.LicenseActivity"
android:label="#string/app_driver_label"
android:icon="#drawable/icon_logo"
android:taskAffinity="com.city.driver"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and I want to set launch activity for Google Play Open button (visible after install) or APK install Open button.
Is it possible with out one more launch icon at apps?
Thanks! =)
From my experience, the Open button after the APK was installed is grayed out (disabled) when there are multiple main activities in your AndroidManifest.xml.
Interestingly enough, it seems that this is only the case for pre-ICS devices. In Ice Cream Sandwich, the Open button is clickable and the first Activity in your AndroidManifest.xml with an android.intent.action.MAIN intent filter will be opened on tap.
<activity android:name=".FirstLaunchActivity" android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
</activity>