1

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.

Community
  • 1
  • 1
cirko
  • 211
  • 2
  • 13
  • i might be wrong but then try to close the rather then closing after – Thilek Sep 17 '15 at 12:38
  • @Thilek argh, it really works :D put it as an answer, will be accepted :) Thanks! – cirko Sep 17 '15 at 12:42
  • I tried the same code with closing uses-permission below the and my activity was never started so i assumed that could be the problem. in any case glad to help. Enjoy.. – Thilek Sep 17 '15 at 12:50

1 Answers1

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>
JozeRi
  • 3,219
  • 6
  • 27
  • 45
hornet2319
  • 379
  • 3
  • 15