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)
Related
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fikriapp"
android:versionCode="1"
android:versionName="1.0">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="FikriApp"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"/>
<activity android:name="View.SplashScreen" android:theme="#style/FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is my manifest code, I want to change the main launcher from MainActivity to my SplashScreen but after I change it, I am not able to debug it because of an error from the manifest. It's Kotlin, not java
<activity android:name="View.SplashScreen"
This is a problem. The package parser that decodes the manifest at installation time expects the package names to be in lowercase, for example view.SplashScreen. The java class name can be in UpperCamelCase.
If you want the package name be relative to your top-level package com.example.fikriapp, then also add a . prefix like .view.SplashScreen.
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"
/>
Im taking the udacity coarse and for some reason android studio wont recognize my MainActivity class. Ive tried cleaning the project, rebuilding and making sure that the names were correct but nothing has solved my problem.
Android Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="androidedx.example.activitylifecycle">
<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=".Activity1"></activity>
<activity android:name=".Activity2" />
<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>
Found the problem, this package name within the code I had to paste
package com.example.android.cookies;
Im not sure why specifically this caused the problem but atleast I solved it.
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.
I want to add another project to my app. But it uses its own "application tag" in AndroidManifest file. And one of its class extends Application
So the problem is I use my own "application" preferences. How can I integrate this new project's "application" preferences to mine ? Will I change somethings on "class extends Application" ?
<activity android:name="com.my.other.project.package.name.MyClassName">
by this you could add your other project activity.
Only the <manifest> and <application> elements are required, they each must be present and can occur only once.
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.animal.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="myOtherPackageName.MyClassName"/> // here where you put your other package name.
</application>