Set default activity, execute before main Activity - android

I want to make register_activity is first run if application open. But, still MainActivity run first. Can anybody help me to fix this.
This is my Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.client18.dd">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.DayNight.NoActionBar">
<activity android:name=".register_activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".signup_activity">
</activity>
<activity android:name=".MainActivity">
</activity>
</application>
</manifest>

When I see your Manifest file I can not see any faults. I suggest to do followings.
1) Uninstall app in emulator / device if its exists, and then run application.
or
2) Rebuild project with cleaning ( Build > Clean Project )
P.S.
If you could practice signup_activity > SignupActivity it is nice and best practice.

Related

Every time when i open class teacher's project to my system it shows this error.Error running app: Default activity not found

I'm a beginner in Android.
Every time when I open class teacher's project to my system it shows this error.
Error running app: Default activity not found.
What should I do to match the same project as my teacher's?
I've tried many solutions.
My Manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.assigncheckbox">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
maybe it happen because you didn't add this activity to your AndroidManifest.xml
<activity
android:name=".yourActivity"
/>

Android studio Default Activity not found

After i have created my own appplication class:
package com.example.bezzabarovaa.myapplication;
import android.app.Application;
import android.content.Context;
/**
* Created by bezzabarovaa on 04.08.2017.
*/
public class app extends Application {
public static Context context;
#Override public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
}
and have changed manifest.xml (changed application to app class)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bezzabarovaa.myapplication">
<app
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</app>
I`ve got a message Error running Unnamed: Default Activity not found
If I will change my classapp back to application in manifest.xml - everything is ok.
Where is a problem?
Thank you.
This <app is supposed to be <application you specify your custom app in here:
<application android:name=".app" ...
Check the documentation the name section says:
The fully qualified name of an Application subclass implemented for
the application. When the application process is started, this class
is instantiated before any of the application's components. The
subclass is optional; most applications won't need one. In the absence
of a subclass, Android uses an instance of the base Application class.
Full example (with your code):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bezzabarovaa.myapplication">
<application
android:name=".app"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
Solved by clicking the "Sync project with gradle files"
I faced the same problem a while ago, after changing my default activity to another.
What solved it was invalidate caches and restart Android Studio:
File -> Invalidate Caches / Restart...
and then clicking on Invalidate and Restart.
Use below code snippet
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bezzabarovaa.myapplication">
<application
android:name=".app"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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>
</application>
</manifest>
You can get Android Studio not to complain by going to the "Edit Configurations" menu (tap "Shift" three times, type "Edit Configurations"), then change Launch Options > Launch to "Nothing".
I'll probably add a generic activity containing instructions, just to avoid any confusion.
Add below line in your manifest application tag
<application
android:name=".app"
...
</application>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.bluetoothlegatt">
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="false" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light">
<activity
android:name="com.example.android.bluetoothlegatt.DeviceScanActivity"
android:icon="#drawable/app_icon"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.android.bluetoothlegatt.DeviceControlActivity" />
<service android:name="com.example.android.bluetoothlegatt.BluetoothLeService" />
</application>
</manifest>
I solved the very same issue by following steps
Close Android Studio
deleting from :
C:\Users\your user name.android/log and gradle folder
C:\Users\your user name.gradle
from C:\Users[your user name]
Restart Computer and run Android studio (it Will take some time to rebuild)

Error parsing the package

This error keeps comes on my phone but it did not come before,I saw all the stack overflow methods but non of them could help me.
I get this error when I test the app from android studio to my phone.I tried on other phones too but still the problem exist.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.patel.pritesh.smstimer">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/sms_timer"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Time_Picker"
android:theme="#style/AppTheme.NoActionBar" />
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:excludeFromRecents="true"
android:exported="true"
android:process="remote"
android:taskAffinity="">
<intent-filter>
<action android:name="SEND" />
</intent-filter>
</receiver>
<receiver
android:name=".NotificationReciever"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="notification" />
</intent-filter>
</receiver>
<receiver
android:name=".deliveryReciever"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="notification_delivered" />
</intent-filter>
</receiver>
<activity android:name=".sms_list">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".sms_review" />
<service
android:name=".alarmService"
android:enabled="true"
android:exported="true"></service>
</application>
</manifest>
This error comes in the run tab:
Unexpected error while executing: am start -n "my.patel.pritesh.smstimer/my.patel.pritesh.smstimer.sms_list" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity
Main tag of manifest file must be manifest. Instead of xml tag, write something like:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dummy"
android:versionCode="100"
android:versionName="1.0.0" >
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/sms_timer"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
...
</application>
</manifest>
As you are using Android Studio, I believe that you are likely have the problem mentioned in this question, and as mentioned here in the answer this error happens when you change the build version for your project (like downgrading or upgrading):
I've been working on this same exact problem for the last 8
hours...you've had no issues after rolling back from 2.0 to 1.5.1?
I've noticed that, even with the error, running the app works fine
sometimes.
so you have to make sure that there is no problem with the new release you are using, then you have to clean and rebuild your project again like mentioned here.
Or you can use the following hint from this answer:
Remove the .idea folder and gradle folder, then click button sync
project with gradle gradle files, after this process finished, you are
able to run your app as normal.

App Not Showing in Apps

I'm debugging using my Samsung Galaxy S5 and every time I run it through Android Studio it works fine and it pops up the app, but then when I click out of it it doesn't show in all of my apps like other apps I've installed to my device. The app will show in my task manager after I close out of it but it still won't show in all of my apps. Really could use some help on this one, thanks.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="us.bisonsoftware.tab" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="Husky Athletics"
android:theme="#style/CustomActionBarTheme">
<activity
android:name=".TabBarExample"
android:label="Husky Athletics"
android:icon="#drawable/ic_launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="geo"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FirstTab" />
<activity android:name=".SecondTab" />
<activity android:name=".ThirdTab" />
</application>
<uses-permission android:name="android.permission.INTERNET" ></uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
Try to make your activity name complete like this:
<activity
android:name="com.example.myapp.TabBarExample"
... >
</activity>
I dont know your package name. You have to fill it by yourself.

app appears in Manage Applications, but not on the main menu

I'm using Eclipse to make an Android app. I've used it before and not had this problem. The console says everything installed ok, so I'm a little confused. I'm not sure what is relevant from logcat, but I can post it if you think that would help.
I've restarted Eclipse, ADB, the emulator, and the Mac several times in various orders and nothing has helped. I know it must be something simple but I haven't played around with this in a few months.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hyser.pinpoint"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
</application>
<activity android:name=".pinpoint" android:label="pinpoint">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Your Activity needs to be inside of your application tag in your manifest
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity android:name=".pinpoint" android:label="pinpoint">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
It's a similar issue to this:
Unable to start Service Intent
Your <activity> tag needs to be in the <application> block.
Is it possible your manifest does not refer to any activities? If you install an app with no activities in the manifest you will get this behavior.

Categories

Resources