Default Activity not found

Asked

Viewed 120 times

0

I was making an app and at one point came across the error Default Activity not found. I tried to undo the changes and the error persisted . Trying to fix it I noticed that all the files .xml project present an error in the field tools:context= .

Androidmanifest.xml

<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"
    tools:ignore="GoogleAppIndexingWarning">

    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/.
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity android:name=".activity.RequisicoesActivity" />
    <activity android:name=".activity.MapsActivity" />
    <activity
        android:name=".activity.CadastroActivity"
        android:label="@string/title_cadastro"
        android:parentActivityName=".activity.MainActivity" />
    <activity
        android:name=".activity.LoginActivity"
        android:label="@string/title_login"
        android:parentActivityName=".activity.MainActivity" />
    <activity
        android:name=".activity.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=".activity.MapsActivity" />
    <activity
        android:name=".activity.CadastroActivity"
        android:label="@string/title_cadastro"
        android:parentActivityName=".activity.MainActivity" />
    <activity
        android:name=".activity.LoginActivity"
        android:label="@string/title_login"
        android:parentActivityName=".activity.MainActivity" />
</application>

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

1 answer

1

Remove the following part of the xml file from Activity ". Activity" and leave it this way:

tools:context=".MainActivity"
  • error persists.Agadeço the attempt

  • Do the following: Start typing in xml tools:context="." and stop and let Android Studio indicate which Activity you want to link your xml to. If android studio does not point any Activity, restart android studio by clearing the cache and do the same procedure.

  • Thank you my Noble. The error of the .xml was solved the code was like this tools:context="marcelootaviodeandrade.turbam.com.activity.MainActivity">&#xA; however Default Activity not found persists.

  • Is your structure app/src/main/java/.../Activity/Mainactivity.java? Have you tried File > Invalidate Caches / Restart?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.