After pausing with work on an Android Studio project for a while, and then coming back and adding it to SVN, I can't get the project to run anymore; it seems to me that the original AndroidManifest.xml was probably lost due to a lack of proper "SVN ignore" rules, and as I created a new Android Studio project on a new machine, updated it from SVN and later commited (and also unfortunately already updated on the other machine I work on), it seems that SVN used the newer manifest file and maybe other files needed for a proper build of the project.
Besides the fact that in the current manifest file, there are several activites missing that I'll have to try to reconstruct there, I now have the problem that I always get the "Default Activity not found" error when trying to build. When I set it to .MainActivity (which is absolutely present in app/src/main/java/com.example.bla.logintest) it says "The activity 'MainActivity' is not declared in AndroidManifest.xml" and thus doesn't compile.
My manifest file now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bla.logintest" >
<uses-permission android:name="android.permission.READ_PHONE_STATE">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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>
<activity
android:name=".EditDB"
android:label="#string/title_activity_edit_diags"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
<activity
android:name=".EditAnswers"
android:label="#string/title_activity_edit_questions"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
</application>
</uses-permission>
</manifest>
Note: I already tried the solutions in [this similar question][1].
[1]: Default Activity not found in Android Studio "this similar question". Rebuilding and invalidating the cache doesn't get me anywhere. I also added
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
to my build.gradle, and this also didn't change anything.
I am aware that the parent to the other 2 activities is still missing and wanted to work on that problem next, but first wanted to have a working default activity.
Do you have any suggestions what I could try? I'm using Android Studio 1.3.2.
This should solve your problem.
You shouldn't write the tag inside the tag.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bla.logintest" >
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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>
<activity
android:name=".EditDB"
android:label="#string/title_activity_edit_diags"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
<activity
android:name=".EditAnswers"
android:label="#string/title_activity_edit_questions"
android:parentActivityName=".MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.bla.logintest.MenuActivity" />
</activity>
</application>
</manifest>
Related
INTRO
Greetings, all!
My Android Studio 4.0.1 project refused to build due to not being able to find an AndroidManifest.xml file that's in /main/ where it should be, according to the documentation. Mass replacing the occurrences of "api" with "implementation" or vice versa hasn't helped.
Thus, what other information do you want for clarification, and what should change to ensure this works?
Thankee!
MANIFEST FILE
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hornet">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
RUN ERRORS WITH DEBUG MODE ACTIVE
Moved to this Google Doc for being too long for this post!
https://docs.google.com/document/d/19OO-OIzFy6IXPEOAdvGZLgXNsW_1sfiZsLDs6H0Jjzs/edit?usp=sharing
Try to rebuild the project or modify project structure. It happens when something was wrong
I am developing an android application using android studio, which has 2 activity so far, LoginActivity and the MainActivity, But when I run the application it installs in my cellphone or virtual machine, but does not appear anywhere. I looked into the installed application and the application is installed. I believe my problem is on the Manifest, but I do not know how to solve it.
The complete code is here on GitHub: https://github.com/SoftwareEngineeringClass/MobileApplication/tree/master/Minerva
and here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<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/AppTheme" >
<activity
android:name=".Minerva"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/app_name" >
<itent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</itent-filter>
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
</application>
I believe the first thing I'd do is set a breakpoint at the beginning of the launcher Activity and see if execution gets there or not. No matter what Logcat will tell you something is wrong. You have to run it in debug mode of course. Attach the debugger. If you give me all your code I'd be more than happy to take a look and give you a definitive answer quickly.
Do you know if you require permissions? , maybe it is the problem that not allow you to run. Also if you can share your activity I can help you.
i had a problem, the Android Studio give me a warning which say:
"The acitivity is not declared in Android Manifest" this appear when i look on the Edit Configuration.
I see in another topic wich says that i have to put in androidManifest.xml
But i already did, and the Android Studio doesnt take it.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.drdower.myapplication" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".AplicacionSencillaInicio"
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=".AplicacionSencillaResultado"
android:label="#string/app_name"/>
</application>
</manifest>
Which problem could be?
Thank u!
copy the code
delete the activity class
recreate one with same name
paste the code
Place your whole package path
com.example.drdower.myapplication.AplicacionSencillaInicio
Then clean your Project.
Also make sure you passed the correct java file name.
I am working with Android Studio 1.0 when suddenly, out of the blue I can not run my app on my phone because it is telling me that it can not find the default activity.
Changing the "default activity" to the specific activity I want to launch, ends in the error that apparently the activity I selected is not declared in AndroidManifest.xml.
Which also isn't true, because I did declare it in the .xml, I didn't remove it or add something new, it always has been there and now it doesn't want to work.
Thank you for reading and maybe answering / commenting. :D
Edit: This is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pack.aproject" >
<application
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" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondPageActivity">
</activity>
</application>
</manifest>
you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
Im working with an android application ,even if I change the names of classes at AndroidManifest.xml the application still work and installing on the tablet but the weird thing that even I removed the launcher activity from the manifest I still got it when I run the app the same xml view !!!
As an indication Im using Maven too.
I think the problem comes from Maven
this is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapps.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity android:name="com.myapps.android.project.login.Connection"
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="com.myapps.android.project.login.Connection" >
</activity>
</application>
</manifest>
I tried:
removing the R file
undeploying the application from the device with this comand:
mvn android:undeploy -Pandroid-15 -Dandroid.device=usb
Uninstall the application manually from the device
removing maven android folder from .m2/repository
I still got the same activity while deploying the application to the device
First of all, there is a little problem in your manifest: you are defining the same activity twice:
<!-- First time definition of "com.myapps.android.project.login.Connection" -->
<activity android:name="com.myapps.android.project.login.Connection"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Second definition of "com.myapps.android.project.login.Connection" -->
<activity android:name="com.myapps.android.project.login.Connection" >
you should remove the second one, it doesn't make sense to have a duplicated definition.
Did you change the Connection.java and/or Connection.xml and nothing hapened?